package cn.fl.capital.controller;

import cmm.comm.facade.framework.api.ISysCdMapApiService;
import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCdMapDQueryCondition;
import cmm.comm.facade.framework.dto.SysCdMapDDTO;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.dto.tripartite.CreditDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.ISysEmpBankAccApiService;
import cmm.user.facade.system.api.ISysOrgApiService;
import cmm.user.facade.system.condition.SysEmpBankAccQueryCondition;
import cmm.user.facade.system.dto.SysEmpBankAccDTO;
import cmm.user.facade.system.dto.SysOrgDTO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.audit.constant.AudStandingBookConstant;
import cn.fl.capital.api.ICapPayFlowApiService;
import cn.fl.capital.condition.CapFundVfDtlQueryCondition;
import cn.fl.capital.condition.CapPayInfoAddMessageQC;
import cn.fl.capital.condition.CapPayInfoQueryCondition;
import cn.fl.capital.condition.CapPayeeInfoQueryCondition;
import cn.fl.capital.constant.CapPayInfoConstant;
import cn.fl.capital.constant.CapPayeeInfoConstant;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.service.ICapFundVfDtlService;
import cn.fl.capital.service.ICapPayInfoAddMessageService;
import cn.fl.capital.service.ICapPayInfoService;
import cn.fl.capital.service.ICapPayeeInfoService;
import cn.fl.capital.vo.*;
import cn.fl.commons.result.ResponseData;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.custpay.dto.RepaymentResultDTO;
import cn.fl.expatriate.condition.AdvBizRecQC;
import cn.fl.expatriate.service.IAdvBizRecService;
import cn.fl.expatriate.vo.AdvBizRecVO;
import cn.fl.export.condition.CapPayInfoExportCondition;
import cn.fl.flowauth.api.IPrjFlowAuthCtrlApiService;
import cn.fl.flowauth.condition.PrjFlowAuthCtrlQC;
import cn.fl.flowauth.constant.PrjFlowAuthCtrlConstant;
import cn.fl.flowauth.dto.PrjFlowAuthCtrlDTO;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.inscare.service.IInsApplicationStagingService;
import cn.fl.inscare.vo.InsApplicationVO;
import cn.fl.orgbankacc.condition.SysOrgBankAccQC;
import cn.fl.orgbankacc.dto.SysOrgBankAccDTO;
import cn.fl.orgbankacc.service.IorgBankAccApiService;
import cn.fl.preloan.IAuditStandingBookService;
import cn.fl.preloan.IInsPlcBscInfoService;
import cn.fl.preloan.IProjectProductMortgateService;
import cn.fl.preloan.condition.AuditStandingBookQueryCondition;
import cn.fl.preloan.condition.InsPlcBscInfoQueryCondition;
import cn.fl.preloan.condition.PrjPrdInvoiceQueryCondition;
import cn.fl.preloan.constants.AuditConstans;
import cn.fl.preloan.dto.PrjPrdMtgDetailRequest;
import cn.fl.preloan.dto.audit.AudStandingBookListRequest;
import cn.fl.preloan.dto.audit.AuditStandingBookDTO;
import cn.fl.preloan.dto.insurance.GetInsPlcBscInfoListRequest;
import cn.fl.preloan.dto.insurance.InsPlcBscInfoDTO;
import cn.fl.product.service.ISplBankService;
import cn.fl.product.vo.SplBankVO;
import cn.fl.project.api.IPrjBscExtApiService;
import cn.fl.project.condition.PrjPrdPaySchMQueryCondition;
import cn.fl.project.condition.PrjPrdPaySchTagQueryCondition;
import cn.fl.project.condition.PrjSplBankAccRQueryCondition;
import cn.fl.project.constant.*;
import cn.fl.project.dto.*;
import cn.fl.project.service.*;
import cn.fl.project.transform.PrjPrdLicInfoVOTransform;
import cn.fl.project.transform.PrjPrdMtgVOTransform;
import cn.fl.project.vo.*;
import cn.fl.ref.fribaseinfo.service.IFriBaseInfoService;
import cn.fl.ref.fribaseinfo.utils.FundRasInsNmChangeUtil;
import cn.fl.ref.fribaseinfo.vo.FriBaseInfoVO;
import cn.fl.risk.service.IRskCstSignLogService;
import cn.fl.risknew.service.IRiskOverdueService;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.vo.SysUlFilesRecVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.constant.facade.framework.constant.SystemConstant;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.FlowCompleteParamsDTO;
import fl.inf.facade.api.IBFSApiService;
import fl.inf.facade.api.ITransLogApi;
import fl.inf.facade.condition.InfTransLogQueryCondition;
import fl.inf.facade.constant.InterfaceConstants;
import fl.inf.facade.dto.InfBfsPayDTO;
import fl.inf.facade.dto.InfTransLogDTO;
import fl.ref.fribaseinfo.condition.FriBaseInfoQueryCondition;
import fl.ref.fribaseinfo.constant.FriBaseInfoConstant;
import fl.ref.fribaseinfo.service.IBankAccInfoApiService;
import fl.spl.facade.bizflow.constant.SysBizFlowRlConstant;
import fl.spl.facade.spl.api.ISplHRiskWarnRecApiService;
import fl.spl.facade.spl.condition.SplHRiskWarnRecQC;
import fl.spl.facade.spl.dto.SplHRiskWarnRecDTO;
import fl.tripartite.facade.api.ITripartiteApi;
import net.sf.json.JSONArray;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @Description: 付款信息表 控制层
 */
@Controller
@RequestMapping("/capital/capPayInfo")
public class CapPayInfoController extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(CapPayInfoController.class);

    /**
     * CapPayInfo 服务层BEAN
     */
    @Autowired
    private ICapPayInfoService capPayInfoService;

    /**
     * PrjBscInfo 服务层BEAN
     */
    @Autowired
    private IPrjBscInfoService prjBscInfoService;
    /**
     * 客户 服务层BEAN
     */
    @Autowired
    private ICstBscInfoService cstBscInfoService;
    @Autowired
    private ICapPayeeInfoService capPayeeInfoService;
    @Autowired
    private ISysUlFilesRecService sysUlFilesRecService;

    @Autowired
    private IPrjPrdLicInfoService prjPrdLicInfoService;

    @Autowired
    private IPrjPrdMtgService prjPrdMtgService;

    @Autowired
    private IPrjPrdDtlService prjPrdDtlService;

    @Autowired
    private ISysOrgApiService sysOrgApiService;

    @Autowired
    private IorgBankAccApiService orgBankAccApiService;

    @Autowired
    private ISysEmpBankAccApiService sysEmpBankAccApiService;

    @Autowired
    private IBFSApiService bFSApiService;

    @Autowired
    private IProjectApiService projectApiService;

    @Autowired
    private IInsPlcBscInfoService insPlcBscInfoService ;

    @Autowired
    private IPrjPrdPaySchMService prjPrdPaySchMService ;

    @Autowired
    private ICapFundVfDtlService capFundVfDtlService ;

    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;
    @Autowired
    private IProjectProductMortgateService productMortgateService;

	@Autowired
	private IPrjCstBscInfoService prjCstBscInfoService;

	/**
	 * PrjLnkComp 服务层BEAN
	 */
	@Autowired
	private IPrjLnkCompService prjLnkCompService;
	
	/**
	 * PrjLnkCompBkAcc 服务层BEAN
	 */
	@Autowired
	private IPrjLnkCompBkAccService prjLnkCompBkAccService;

    /**
     * IPrjSplBankAccRService 项目供应商银行账户关系 服务层接口
     */
    @Autowired
    private  IPrjSplBankAccRService prjSplBankAccRService ;

    @Autowired
    private ISplBankService splBankService ;
    
//    @Autowired
//    private IIcbcApi icbcApi;
    
    @Autowired
    private ITransLogApi transLogApi;
    
    @Autowired
    private ITripartiteApi tripartiteApi;
   @Autowired
   private IPrjPrdBscInfoService prjPrdBscInfoService;
   @Autowired
   private ICapPayInfoAddMessageService capPayInfoAddMessageService;
   @Autowired
  	private IInsApplicationStagingService insApplicationStagingService;

    @Autowired
    private IFriBaseInfoService friBaseInfoService;//融资机构基础信息表

    @Autowired
    private IRskCstSignLogService rskCstSignLogService;

    @Autowired
    private IPrjBscExtApiService prjBscExtApiService;

    @Autowired
    private ISplHRiskWarnRecApiService splHRiskWarnRecApiService;

    /**
     * PrjPrdInvoice 服务层BEAN
     */
    @Autowired
    private IPrjPrdInvoiceService prjPrdInvoiceService;

    @Autowired
    private IAdvBizRecService advBizRecService;

    @Autowired
    private IPrjPrdPaySchTagApiService prjPrdPaySchTagApiService;
    @Autowired
    private IPrjPaySchMYqService prjPaySchMYqService;

    @Autowired
    private IAuditStandingBookService auditStandingBookService;

    @Autowired
    private IPrjFlowAuthCtrlApiService prjFlowAuthCtrlService;

    @Autowired
    private ICapPayFlowApiService capPayFlowApiService;

    @Autowired
    private IBankAccInfoApiService bankAccInfoApiService;

    @Autowired
    private IRiskOverdueService overdueService;

    @Autowired
    private ISysCdMapApiService sysCdMapApiService;

    /**
     * 到列表页面
     */
    @RequestMapping(value = "/toListPage.do", method = {RequestMethod.GET})
    public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toListPage", "加载CapPayInfo列表页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayInfoList");
        //项目类型
        List<KeyValueVO> projectTypeList = this.prjBscInfoService.getPrjTypCdALLKV();
        //业务类型
        //List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
        // 事业部
        List<KeyValueVO> orgList = this.cstBscInfoService.searchBusinessOrgList();
        //付款状态
        List<KeyValueVO> payStsCdList = this.capPayInfoService.getPayStsCdList();
        //申请来源
        List<KeyValueVO> applyResCdList = this.capPayInfoService.getApplyResCdList();
        //首期款代收
        List<KeyValueVO> fstColCdList = this.capPayInfoService.getFstColCdList();
        //业务线字典List
        List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");

        mav.addObject("prjTypCdList", projectTypeList);
        mav.addObject("buOrgCdList", JSON.toJSONString(orgList));
        mav.addObject("payStsCdList", JSON.toJSONString(payStsCdList));
        mav.addObject("applyResCdList", JSON.toJSONString(applyResCdList));
        mav.addObject("fstColCdList", JSON.toJSONString(fstColCdList));
        mav.addObject("currentOrgCd",CurrentThreadContext.getCurrentOrgCd());
        //第三方机构
        FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
        qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
        qc.setInsUseCd("2");
        qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
        qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
        List<FriBaseInfoVO> friBaseInfoVOS = this.friBaseInfoService.searchList(qc);
        //根据金融机构业务线,设置金融机构名称展示字段值
        FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOS,bussinessLineDicList);
        mav.addObject("friBaseList", friBaseInfoVOS);

        BaseLogUtils.newLogger("获取当前用户组织架构cd:" + JSON.toJSONString(CurrentThreadContext.getCurrentOrgCd()) + ",组织架构:" + CurrentThreadContext.getCurrentOrgShtNm()).info();
        SysCdMapDQueryCondition sysCdMapDQC = new SysCdMapDQueryCondition();
        sysCdMapDQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
        sysCdMapDQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
        sysCdMapDQC.setmTypCd("M1076");
        List<String> getsCodeList = new ArrayList<>();
        getsCodeList.add("orgCd");
        sysCdMapDQC.setsCodeList(getsCodeList);
        BaseLogUtils.newLogger("查询映射的流程KEY开始.condition:" + JSON.toJSONString(sysCdMapDQC)).info();
        List<SysCdMapDDTO> sysCdMapDDTOList = this.sysCdMapApiService.searchSysCdMapDWithTargetList(sysCdMapDQC);
        BaseLogUtils.newLogger("查询映射的流程KEY结束.sysCdMapDDTOList:" + JSON.toJSONString(sysCdMapDDTOList)).info();
        boolean mtgExpFlowStartBtnShow = false;
        for (SysCdMapDDTO sysCdMapDDTO : sysCdMapDDTOList) {
            String tCode = sysCdMapDDTO.getTCode();
            if (CurrentThreadContext.getCurrentOrgCd().contains(tCode)) {
                mtgExpFlowStartBtnShow = true;
            }
        }
        BaseLogUtils.newLogger("当前用户是否有抵押外派流程按钮权限.mtgExpFlowStartBtnShow:{},usrNm:{},orgCd:{}", mtgExpFlowStartBtnShow, CurrentThreadContext.getCurrentUserName(), CurrentThreadContext.getCurrentOrgCd()).info();
        if (mtgExpFlowStartBtnShow) {
            mav.addObject("mtgExpFlowStartBtnShow", true);
        }
        return mav;
    }

    /**
     * 到新增页面
     */
    @RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toAddPage", "加载CapPayInfo Add页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayInfoModify");
        String sysCd = CurrentThreadContext.getCurrentSysCd(); 
		String orgCd = CurrentThreadContext.getCurrentOrgCd();
        String id = request.getParameter("id");//付款ID
        String isGpsNode = request.getParameter("isGpsNode");
        try {
			String payTypCd = request.getParameter("payTypCd");//付款类型
			String entrance = request.getParameter("entrance");//付款信息控制：付款时间、付款金额、付款方式 是否可编辑 0.都不可编辑 1.都可编辑 2.只能编辑付款金额 3.只能编辑供应商返利金额
			String accCtrl = request.getParameter("accCtrl");//收款账号控制：是否可编辑 0：可编辑 1.不可编辑
			//String btnCtrl = request.getParameter("btnCtrl");//按钮控制
			String ctrlKey = request.getParameter("ctrlKey");//控制资料上传审核 1.可上传编辑 2.审核 3.不可操作
			String bizFlag = request.getParameter("bizFlag"); // 狮桥业务：1 工行业务 2
			String isAddBank = request.getParameter("isAddBank"); // 0: 不可添加 1：可添加
			String isOrDefaultTime = request.getParameter("isOrDefaultTime"); // 实付款时间 0: 不显示默认时间 1：显示默认时间
			String flowKey = request.getParameter("flowKey");//流程定义key
			String authNm = request.getParameter("authNm");//抵押权人名称标识
        // 工行卡贷维护是否放款状态 "0": 不可以添加 "1":可添加
        String isAddPayerStatusCd = request.getParameter("isAddPayerStatusCd");
        String payerStatusCd = "0";
        //暂控制是否可修改购置税真实金额 0.不可修改 1.可修改
        String isModifyAmt = request.getParameter("isModifyAmt");
        //控制交车日期的填写 0:不可编辑 1:可编辑 其他:不显示
        String isNeedAddTime = request.getParameter("isNeedAddTime");
        
        //控制是否团单的维护
        String saveIsGrp = request.getParameter("saveIsGrp");
        String operateInsPlc = request.getParameter("operateInsPlc");//是否可操作保单

        //是否
        List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
        mav.addObject("yesOrNOList", yesOrNOList);
        //是否可发起流程
        String isAllowPay = request.getParameter("isAllowPay");
        if (StringUtils.isNotBlank(isAllowPay)){
            mav.addObject("isAllowPay", isAllowPay);
        }
        //查询项目的业务模式
        
        if(StringUtils.isNotBlank(id)){
        	  CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(id));
        	  BaseLogUtils.info(logger,"toAddPage","放款流程.付款主信息.capPayInfoVO:" + JSON.toJSONString(capPayInfoVO),CurrentThreadContext.getCurrentUserName());
        	  if(null != capPayInfoVO.getPrjId()){
        		  PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(capPayInfoVO.getPrjId());
        		  mav.addObject("bizTypCd", prjBscInfoVO.getBizTypCd());//业务类型
        		  mav.addObject("buOrgCd",capPayInfoVO.getBuOrgCd());//事业部
                  mav.addObject("isSplMfr",prjBscInfoVO.getIsSplMfr());//是否厂商业务字段
        		  if(null != capPayInfoVO.getPaySchId()){
        			 mav.addObject("paySchId",capPayInfoVO.getPaySchId());//支付表编号
                	 PrjPrdPaySchMVO prdPaySchMVO = this.prjPrdPaySchMService.selectById(capPayInfoVO.getPaySchId());
                	 String lsDt = DateUtils.formatDateToString(prdPaySchMVO.getLsDt(), "yyyy-MM-dd");
                	 mav.addObject("lsDt",lsDt); //起租日
                 }
        		  
        	  }
				  mav.addObject("prjPrdDtlId", capPayInfoVO.getPrjPrdDtlId());//项目产品明细id
				  PrjPrdMtgVO prdMtgVO = this.prjPrdMtgService.selectById(capPayInfoVO.getPrjPrdDtlId());
					if(null !=prdMtgVO){
						String pledgeeAuthNm = prdMtgVO.getPledgeeAuthNm();//抵押权人名称
						mav.addObject("pledgeeAuthNm", pledgeeAuthNm);
					}
					//抵押权人名称数据字典查询
					List<KeyValueVO> pledgeeNmList = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_PLEDGEE_NM, sysCd, orgCd);
					mav.addObject("pledgeeNmList", pledgeeNmList);
			}
     
			if (StringUtils.isNotBlank(flowKey)) {
			    mav.addObject("flowKey", flowKey);
			}
			if (StringUtils.isBlank(entrance)) {
			    entrance = "0";
			}
			if (StringUtils.isBlank(accCtrl)) {
			    accCtrl = "0";
			}
			if (StringUtils.isBlank(ctrlKey)) {
			    ctrlKey = "1";
			}
			if (StringUtils.isBlank(bizFlag)) {
			    bizFlag = "1";
			}
			if (StringUtils.isBlank(isAddBank)) {
			    isAddBank = "0";
			}
			if (StringUtils.isBlank(isOrDefaultTime)) {
			    isOrDefaultTime = "0";
			}
			if (StringUtils.isBlank(isModifyAmt)) {
			    isModifyAmt = "0";
			}
			if (StringUtils.isBlank(isAddPayerStatusCd)) {
			    isAddPayerStatusCd = "0";
			}
			mav.addObject("id", id);
			mav.addObject("payTypCd", payTypCd);
			mav.addObject("entrance", entrance);
			mav.addObject("accCtrl", accCtrl);
			mav.addObject("ctrlKey", ctrlKey);
			mav.addObject("isAddBank", isAddBank);
			mav.addObject("isModifyAmt", isModifyAmt);
			mav.addObject("saveIsGrp", saveIsGrp);
			mav.addObject("authNm", authNm);
			mav.addObject("isGpsNode", isGpsNode);
			mav.addObject("operateInsPlc", operateInsPlc);
			/**
			 * jiangzg add 2017-11-13 15:53:49 工行卡贷 begin
			 */
			List<KeyValueVO> payerCdList = this.sysDictionaryApiService.getKvList(CapitalConstant.CODE_THIRD_CAP_STS_CD, CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentBuOrgCd());
			mav.addObject("payerStatusCdList", JSON.toJSONString(payerCdList));
			/**
			 * jiangzg add 2017-11-13 15:53:49 工行卡贷 end
			 */

        //查询付款信息
        CapPayInfoVO vo = this.capPayInfoService.selectById(Long.valueOf(id));
        if (null == vo) {
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "未找到付款信息");
        }
        Long prjId = vo.getPrjId();
        PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
        if (PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(vo.getBuOrgCd())) {
            if (PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(vo.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ZCSS.equals(vo.getPrjTypCd())) {
                mav.addObject("gpsFlag", capPayInfoService.getGPSFlag(prjBscInfoVO));
                mav.addObject("noPassAudCarNum", capPayInfoService.getNoPassAudCarNum(prjBscInfoVO));
                mav.addObject("noSplPassNum", capPayInfoService.getNoSplPassNum(vo.getSplId()));
            }
        }
            if (PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(prjBscInfoVO.getBuOrgCd())) {
                if (PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjBscInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjBscInfoVO.getPrjTypCd())) {
                    mav.addObject("gpsFlag", capPayInfoService.getGPSFlag(prjBscInfoVO));
                }
            }
        // 新能源信审审核修改付款额  新能源事业部 新能源提前放款流程、新能源汽车正常放款流程、新能源汽车提前放款流程（需上牌） 项目类型	城配业务
//            FLOW_00000013_002_001 	新能源汽车放款流程
//            FLOW_00000013_007_001 	新能源汽车提前放款流程
//            FLOW_00000013_007_002	新能源汽车提前放款流程（需上牌）

            if("00000013".equals(vo.getBuOrgCd()) && "CPYW".equals(vo.getPrjTypCd())){
                String taskDefKey = request.getParameter("taskDefKey");//任务KEY
                if("FLOW_00000013_002_001".equals(flowKey) || "FLOW_00000013_007_001".equals(flowKey) ||"FLOW_00000013_007_002".equals(flowKey)||
                        "FLOW_00000013_002_001_002".equals(taskDefKey)|| "FLOW_00000013_007_001_002".equals(taskDefKey)|| "FLOW_00000013_007_002_002".equals(taskDefKey)){
                   // String tagTypeCd = "3";// 查询支付表状态
                    PrjPrdPaySchTagQueryCondition condition = new PrjPrdPaySchTagQueryCondition();
                    condition.setIsDel(0);
                    condition.setPaySchNo(vo.getPaySchNo());
                    List<PrjPrdPaySchTagDTO> list = prjPrdPaySchTagApiService.searchPrjPrdPaySchTagList(condition);
                    if(CollectionUtils.isNotEmpty(list) && "3".equals(list.get(0).getTagTypeCd())){
                        mav.addObject("entrance", 2);
                    }
                }
            }
            //是否展示发送至录单员按钮：重卡事业部、二手车金融事业部、客车事业部、新能源事业部、轻卡事业部，未提交且未发送录单请求
            String showRec = "0";
            if (PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_ORG_CD_ESC.equals(vo.getBuOrgCd())
                    || PrjBscInfoConstant.CODE_BU_ORG_CD_ZC.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(vo.getBuOrgCd())
                    || PrjBscInfoConstant.CODE_BU_ORG_CD_QK.equals(vo.getBuOrgCd())) {
                if (CapitalConstant.CODE_CAP_PAY_STS_CD_1.equals(vo.getPayStsCd())) {
                    //查询台账
                    AuditStandingBookQueryCondition bookQueryCondition = new AuditStandingBookQueryCondition();
                    bookQueryCondition.setPayId(vo.getId());
                    bookQueryCondition.setBookTypeCd(AudStandingBookConstant.AUD_TYP_CD_FL);
                    AudStandingBookListRequest audRequest = new AudStandingBookListRequest();
                    audRequest.setCondition(bookQueryCondition);
                    audRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
                    audRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
                    BaseLogUtils.newServiceLogger("付款申请查询台账信息 payId:" + vo.getId() + ",audRequest:" + JSON.toJSONString(audRequest)).info();
                    ResponseData<List<AuditStandingBookDTO>> audResponse = this.auditStandingBookService.searchList(audRequest);
                    BaseLogUtils.newServiceLogger("付款申请查询台账信息 payId:" + vo.getId() + ",audResponse:" + JSON.toJSONString(audResponse)).info();
                    if (ResponseData.SUCCESS_CODE.equals(audResponse.getCode())) {
                        List<AuditStandingBookDTO> audResponseData = audResponse.getData();
                        if (CollectionUtils.isEmpty(audResponseData)) {
                            showRec = "1";
                        }
                    }
                    //校验当前用户是否被限制
                    PrjFlowAuthCtrlQC strlQc = new PrjFlowAuthCtrlQC();
                    strlQc.setIsValid(1);
                    strlQc.setPassiveCtrlId(CurrentThreadContext.getCurrentUserId());
                    strlQc.setFlowStartTm(DateUtils.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
                    strlQc.setCtrlPrjTypCd(vo.getPrjTypCd());
                    strlQc.setCtrlContent(PrjFlowAuthCtrlConstant.CTRL_CONTENT_2);
                    //是否允许发送至录单员：0-禁止
                    strlQc.setIsAllowSendToRecoder("0");
                    BaseLogUtils.newLogger("付款申请.查询项目流程权限控制.payId:{},qc:{}", vo.getId(), JSON.toJSONString(strlQc)).info();
                    List<PrjFlowAuthCtrlDTO> prjFlowAuthCtrlDTOS = prjFlowAuthCtrlService.searchList(strlQc);
                    BaseLogUtils.newLogger("付款申请.查询项目流程权限控制.payId:{},result:{}", vo.getId(), prjFlowAuthCtrlDTOS.size()).info();
                    if (CollectionUtils.isNotEmpty(prjFlowAuthCtrlDTOS) && prjFlowAuthCtrlDTOS.size() > 0) {
                        for (PrjFlowAuthCtrlDTO prjFlowAuthCtrlDTO : prjFlowAuthCtrlDTOS) {
                            if (StringUtils.isNotEmpty(CurrentThreadContext.getCurrentOrgCd()) && CurrentThreadContext.getCurrentOrgCd().startsWith(prjFlowAuthCtrlDTO.getPassiveCtrlOrgCd())) {
                                showRec = "0";
                            }
                        }
                    }
                }
            }
            mav.addObject("showRec",showRec);

            //是否展示银行信息采集：所属机构为建行 ccbanktb时，当前合同号下其余支付表号放款状态都不是“未申请”或者“放款失败”的时候，放款申请显示银行信息采集标签页
            String isShowAccTab = "0";
            if (PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(prjBscInfoVO.getInsCode())) {
                isShowAccTab = "1";
                CapPayInfoQueryCondition queryCondition = new CapPayInfoQueryCondition();
                queryCondition.setContNo(prjBscInfoVO.getLsCntNo());
                queryCondition.setExcludeId(vo.getId());
                queryCondition.setIsDel(0);
                List<CapPayInfoVO> capPayInfoVOS = capPayInfoService.searchList(queryCondition);
                BaseLogUtils.newWebLogger("查询付款数据：" + JSON.toJSONString(capPayInfoVOS)).info();
                for (CapPayInfoVO payInfoVO : capPayInfoVOS) {
                    if (CapitalConstant.CODE_CAP_PAY_STS_CD_1.equals(payInfoVO.getPayStsCd())
                            || CapitalConstant.CODE_CAP_PAY_STS_CD_4.equals(payInfoVO.getPayStsCd())){
                        isShowAccTab = "0";
                    }
                }
            }
            mav.addObject("isShowAccTab",isShowAccTab);

            //风险标记开始
            List<Long> prjPrdDtlIdList = new ArrayList<Long>();
            prjPrdDtlIdList.add(vo.getPrjPrdDtlId());
            Map<String,String> result = this.rskCstSignLogService.searchRskResInfo(vo.getCstId(),Long.valueOf(vo.getPrjId()),prjPrdDtlIdList);
            if(MapUtils.isNotEmpty(result)){
                //客户风险标记
                mav.addObject("rskCstSignDesc",result.get("rskCstSignDesc"));
                //设备风险标记
                mav.addObject("rskProdSignDesc", result.get("rskProdSignDesc"));
                //担保人风险标记
                mav.addObject("rskGuarSignDesc", result.get("rskGuarSignDesc"));
                //vin风险标记
                mav.addObject("rskVinSignDesc",result.get("rskVinSignDesc"));
                //承租人手机号风险标记
                mav.addObject("rskCstMpSignDesc", result.get("rskCstMpSignDesc"));
                //挂靠公司风险标记
                mav.addObject("rskLnkSignDesc", result.get("rskLnkSignDesc"));
                //供应商风险标记
                mav.addObject("rskSplSignDesc", result.get("rskSplSignDesc"));
            }else{
                //客户风险标记
                mav.addObject("rskCstSignDesc","");
                //设备风险标记
                mav.addObject("rskProdSignDesc", "");
                //担保人风险标记
                mav.addObject("rskGuarSignDesc", "");
                //vin风险标记
                mav.addObject("rskVinSignDesc","");
                //承租人手机号风险标记
                mav.addObject("rskCstMpSignDesc", "");
                //挂靠公司风险标记
                mav.addObject("rskLnkSignDesc", "");
                //供应商风险标记
                mav.addObject("rskSplSignDesc", "");
            }
        //yaoxiurong
            PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(vo.getPrjPrdId());
            if(StringUtils.isNotBlank(prjPrdBscInfoVO.getReceiveTypeCd()) && prjPrdBscInfoVO.getReceiveTypeCd().equals(CapitalConstant.CODE_PAYEE_TYP_CD_8)){
                vo.setCstDbrId(prjPrdBscInfoVO.getSplId());
            }
        if("1".equals(isAddPayerStatusCd)){
        	//查询是否上装支付表
        	if(StringUtils.isNotEmpty(vo.getPrjPrdId())){
        		if(null!=prjPrdBscInfoVO && CarStyleConstant.PRD_TYP_8.equals(prjPrdBscInfoVO.getPrdTypCd())){
        			isAddPayerStatusCd = "0";
        		}
        	}
        }
        mav.addObject("isAddPayerStatusCd", isAddPayerStatusCd);
        PrjPrdPaySchMVO prjPrdPaySchMVO = null;
        String thdPayAmt = null;
        String thdPayDt  = null;
        if (null != vo.getPaySchId()) {
            prjPrdPaySchMVO = this.prjPrdPaySchMService.selectById(vo.getPaySchId());
            if (null != prjPrdPaySchMVO) {
                bizFlag = prjPrdPaySchMVO.getBizFlag();
                payerStatusCd = prjPrdPaySchMVO.getPayerStsCd() == null ? "0" : prjPrdPaySchMVO.getPayerStsCd();
                thdPayAmt = prjPrdPaySchMVO.getThdPayAmt() == null ? null : String.valueOf(DecimalUtils.convertFenToYuan(prjPrdPaySchMVO.getThdPayAmt()));
                thdPayDt = prjPrdPaySchMVO.getThdPayDt() == null ? null :  DateUtils.formatDateToString(prjPrdPaySchMVO.getThdPayDt(), "yyyy-MM-dd");
            }
        }
        mav.addObject("payerStatusCd", payerStatusCd);
        mav.addObject("thdPayAmt",thdPayAmt);
        mav.addObject("thdPayDt",thdPayDt);
        //放款类型为空判断
        if (StringUtils.isBlank(payTypCd)) {
            mav.addObject("payTypCd", vo.getPayTypCd());
        }

        //Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
        vo = this.capPayInfoService.getPayInfoCount(vo);
        mav.addObject("capPayInfoVO", vo);

        //收款方类型
        List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
        mav.addObject("payeeTypCdList", JSON.toJSONString(payeeTypCdList));
        //款项
        /*List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
        mav.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));*/
        //付款方式
        List<KeyValueVO> payWayCdList = this.capPayInfoService.getPayWayCdList();
        mav.addObject("payWayCdList", JSON.toJSONString(payWayCdList));
        //this.prepare(request,mav);
        //账户类型
        List<KeyValueVO> bkAccTypCdList = this.capPayInfoService.getBkAccTypCdList();
        mav.addObject("bkAccTypCdList", JSON.toJSONString(bkAccTypCdList));

        //查询收款方信息
        CapPayeeInfoQueryCondition payeeInfoQueryCondition = new CapPayeeInfoQueryCondition();
        payeeInfoQueryCondition.setPayId(Long.valueOf(id));
        payeeInfoQueryCondition.setSortOrder(" PURP_CD ");
        BaseLogUtils.info(logger,"toAddPage","放款流程.付款子信息.payeeInfoQueryCondition:" + JSON.toJSONString(payeeInfoQueryCondition),CurrentThreadContext.getCurrentUserName());
        List<CapPayeeInfoVO> payeeVOList = capPayeeInfoService.searchList(payeeInfoQueryCondition);
        BaseLogUtils.info(logger,"toAddPage","放款流程.付款子信息.payeeVOList:" + JSON.toJSONString(payeeVOList),CurrentThreadContext.getCurrentUserName());
        Map<String, CapPayeeInfoVO> payeeMap = null;
        if (CollectionUtils.isNotEmpty(payeeVOList)) {
            payeeMap = new HashMap<>(payeeVOList.size());
            for (CapPayeeInfoVO payeeInfoVO : payeeVOList) {
                payeeMap.put(payeeInfoVO.getPurpCd(), payeeInfoVO);
            }
        }
        BaseLogUtils.info(logger,"toAddPage","放款流程.付款子信息.payeeMap:" + JSON.toJSONString(payeeMap),CurrentThreadContext.getCurrentUserName());
        /**
         * 获取配置的默认付款支付方式 jiangzg 2017-11-21 17:26:19 add
         */
        Map<String,String> payWayCdMap = null ;
        List<KeyValueVO> keyValueVOList = this.sysDictionaryApiService.getKvList(CapitalConstant.CODE_CAP_PAY_WAY_CD_DEFAULT,CapitalConstant.SYSCD,CapitalConstant.SYSORG);
        if(CollectionUtils.isNotEmpty(keyValueVOList)){
            payWayCdMap = new HashMap<>(keyValueVOList.size());
            for(KeyValueVO keyValVO : keyValueVOList){
                payWayCdMap.put(keyValVO.getKey(),keyValVO.getValue());
            }
        }
        // 获取配置的默认付款支付方式 jiangzg 2017-11-21 17:26:19 add end
        Map<String, Long> rebateMap = new HashMap<>(16);
        //查询事业部对应的收款账号有几个用途
            List<KeyValueVO> kvList = new ArrayList<KeyValueVO>();
            kvList = this.capPayeeInfoService.getPayeeByOrgCd(vo.getBuOrgCd(),vo.getPaySchId(),rebateMap,vo.getPrjTypCd());
        BaseLogUtils.info(logger,"toAddPage","放款流程.收款账号有几个用途.kvList:" + JSON.toJSONString(kvList),CurrentThreadContext.getCurrentUserName());
        if (CollectionUtils.isNotEmpty(kvList)) {
            List<CapPayeeInfoVO> payeeList = new ArrayList<>(kvList.size());
            List<String> purpList = new ArrayList<>(kvList.size());
            CapPayeeInfoVO payee = null;
            Long feeAmt = null;
            DecimalFormat df = new DecimalFormat("######0.00");//格式化保留两位小数
            Long amountPayable = 0L;
			Long amountPayables = 0L;
			Long installment = 0L;
			Long firstAmt = 0L;
			Long totalAmt = 0L;
            for (KeyValueVO kv : kvList) {
                //1.收款账号  6.车立行账号
                if(CapitalConstant.CODE_SPL_BK_PURP_CD_1.equals(kv.getKey())
                        ||CapitalConstant.CODE_SPL_BK_PURP_CD_6.equals(kv.getKey())){
                    if(CapitalConstant.CODE_SPL_BK_PURP_CD_6.equals(kv.getKey()) && !"ZZKP".equals(vo.getPrjTypCd())){
                        continue;
                    }
                    if (CollectionUtils.isMapNotEmpty(payeeMap) && payeeMap.containsKey(kv.getKey())) {
                        payee = payeeMap.get(kv.getKey());
                        if (StringUtils.isEmpty(payee.getPayAmt())) {
                            payee.setPayAmt(vo.getPayAmt());
                        }
                        if (StringUtils.isBlank(payee.getPayWayCd())) {
                            if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag)) {
                                if(CollectionUtils.isMapNotEmpty(payWayCdMap)){
                                    if(payWayCdMap.containsKey(vo.getPrjTypCd())){
                                        payee.setPayWayCd(payWayCdMap.get(vo.getPrjTypCd()));
                                    }
                                }
                            }
                            if(StringUtils.isBlank(payee.getPayWayCd())){
                                payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                            }
                        }
                        if (null != payee.getActPayTm()) {
                            payee.setActPayTms(DateUtils.formatDateToString(payee.getActPayTm(), DateUtils.YYYY_MM_DD));
                        } else {
                            if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag) && "1".equals(isOrDefaultTime)) {
                                payee.setActPayTms(DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DD)); //工行默认带出
                            }
                        }
                        if (StringUtils.isNotEmpty(payee.getActPayAmt())) {
                            payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getActPayAmt())));
                        } else {
                            if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag) && "1".equals(isOrDefaultTime)) {
                                payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt()))); //工行默认带出
                            }
                        }
                        //处理金额 yao
		                if (payee.getPurpCd().equals(CapitalConstant.CODE_SPL_BK_PURP_CD_1)) {
	                        Long[] payAmt = this.prjPrdDtlService.downPaymentAmount(vo.getPrjPrdDtlId(),vo.getPaySchId());
							for (int i = 0; i < payAmt.length; i++) {
								firstAmt = payAmt[0];//首期
								totalAmt = payAmt[1];//总和
							}
							if ( firstAmt != 0L && totalAmt != 0L ) {
								InsApplicationVO insApplicationVO = this.insApplicationStagingService.getInstallmentInformation(vo.getPrjPrdDtlId(),vo.getPaySchId());
	    						mav.addObject("insApplicationVO",insApplicationVO);
	    						installment = 1L;
	    						amountPayable = payee.getRealPayAmt();
	    						mav.addObject("amountPayableq",DecimalUtils.convertFenToYuan(amountPayable));
							}
		                }
		                payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt())));
						mav.addObject("firstAmt",DecimalUtils.convertFenToYuan(firstAmt));
		                mav.addObject("totalAmt",DecimalUtils.convertFenToYuan(totalAmt));
		                mav.addObject("installment",installment);
		                mav.addObject("amountPayable",DecimalUtils.convertFenToYuan(amountPayable));
                    } else {
                        payee = new CapPayeeInfoVO(kv.getKey(), kv.getValue());
                        payee.setPayAmt(vo.getPayAmt());
                        if(CapitalConstant.CODE_SPL_BK_PURP_CD_6.equals(kv.getKey()) && "ZZKP".equals(vo.getPrjTypCd())){
                            payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_6);
                        }else{
                            payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                        }
                        payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(vo.getPayAmt())));
                        if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag)) {
                            if(CollectionUtils.isMapNotEmpty(payWayCdMap)){
                                if(payWayCdMap.containsKey(vo.getPrjTypCd())){
                                    payee.setPayWayCd(payWayCdMap.get(vo.getPrjTypCd()));
                                }
                            }
                        }
                        if(StringUtils.isBlank(payee.getPayWayCd())){
                            payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                        }
                    }

                    if(CapitalConstant.CODE_SPL_BK_PURP_CD_6.equals(kv.getKey()) && "ZZKP".equals(vo.getPrjTypCd())){
                        payee.setPurpCdNm(kv.getValue());
                        payeeList.add(1,payee);
                        purpList.add(1,payee.getPurpCd());
                    }else{
                        payeeList.add(payee);
                        purpList.add(payee.getPurpCd());
                    }
                }else{
                    //返利账户、GPS返利账户、保险、购置税、保养
                    if(CollectionUtils.isMapNotEmpty(rebateMap)&&rebateMap.containsKey(kv.getKey())){
                        feeAmt = rebateMap.get(kv.getKey());
                        if(feeAmt.equals(0L)){
                            continue;
                        }
                        if (CollectionUtils.isMapNotEmpty(payeeMap) && payeeMap.containsKey(kv.getKey())) {
                            payee = payeeMap.get(kv.getKey());
                            //应付金额有可能会修改
                            if(StringUtils.isEmpty(payee.getPayAmt())){
                                payee.setPayAmt(feeAmt);
                                payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                            } else {
                                payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt())));
                            }
                            if(StringUtils.isBlank(payee.getPayWayCd())){
                                if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag)) {
                                    if(CollectionUtils.isMapNotEmpty(payWayCdMap)){
                                        if(payWayCdMap.containsKey(vo.getPrjTypCd())){
                                            payee.setPayWayCd(payWayCdMap.get(vo.getPrjTypCd()));
                                        }
                                    }
                                }
                                if(StringUtils.isBlank(payee.getPayWayCd())){
                                    payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                                }
                            }
                            if (null != payee.getActPayTm()) {
                                payee.setActPayTms(DateUtils.formatDateToString(payee.getActPayTm(), DateUtils.YYYY_MM_DD));
                            } else {
                                if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag) && "1".equals(isOrDefaultTime)) {
                                    payee.setActPayTms(DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DD)); //工行默认带出
                                }
                            }
                            if (StringUtils.isNotEmpty(payee.getActPayAmt())) {
                                payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getActPayAmt())));
                            } else {
                                if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag) && "1".equals(isOrDefaultTime)) {
                                    payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt()))); //工行默认带出
                                }
                            }
                            if (StringUtils.isNotEmpty(payee.getRealPayAmt())) {
                                payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getRealPayAmt())));
                            } else {
                                payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt())));
                            }
                            if (null == payee.getBkId()) {
                                if (CapitalConstant.CODE_SPL_BK_PURP_CD_2.equals(kv.getKey())) {
                                    PrjSplBankAccRQueryCondition queryCondition = new PrjSplBankAccRQueryCondition();
                                    queryCondition.setIsDel(0);
                                    queryCondition.setPrjPrdId(vo.getPrjPrdId());
                                    queryCondition.setPurpCd(CapitalConstant.CODE_SPL_BK_PURP_CD_2);
                                    List<PrjSplBankAccRVO> prjSplBankAccRVOList = prjSplBankAccRService.searchList(queryCondition);
                                    if (CollectionUtils.isNotEmpty(prjSplBankAccRVOList)) {
                                        Long splAccNoId = prjSplBankAccRVOList.get(0).getSplAccNoId();
                                        if (null != splAccNoId) {
                                            SplBankVO splBankVO = splBankService.selectById(splAccNoId);
                                            if (null != splBankVO) {
                                                payee.setBkId(splBankVO.getId());
                                                payee.setAccNo(splBankVO.getAccNo());
                                                payee.setIsDel(0);
                                                payee.setRealPayAmt(feeAmt);
                                                payee.setRcptUnt(splBankVO.getRcptUnt());
                                                payee.setPurpCd(CapitalConstant.CODE_SPL_BK_PURP_CD_2);
                                                payee.setPayId(vo.getId());
                                                payee.setPayeeBkNm(splBankVO.getBkNm());
                                                payee.setPayeeBkNo(splBankVO.getBkNo());
                                                payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                                                payee.setBkAccTypCd(splBankVO.getBizTypCd());
                                                payee.setCrtTm(new Date());
                                                payee.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                                            }
                                        }
                                    }
                                }
                            }
                        } else {
                            payee = new CapPayeeInfoVO(kv.getKey(), kv.getValue());
                            payee.setPayAmt(feeAmt);
                            if(CapitalConstant.CODE_SPL_BK_PURP_CD_5.equals(kv.getKey())){
                                if("ZZKP".equals(vo.getPrjTypCd())){
                                    payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_6);
                                }else{
                                    payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_4);
                                }
                            }else{
                                payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                            }
                            payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                            if (StringUtils.isNotBlank(bizFlag) && "2".equals(bizFlag)) {
                                if(CollectionUtils.isMapNotEmpty(payWayCdMap)){
                                    if(payWayCdMap.containsKey(vo.getPrjTypCd())){
                                        payee.setPayWayCd(payWayCdMap.get(vo.getPrjTypCd()));
                                    }
                                }
                            }
                            if(StringUtils.isBlank(payee.getPayWayCd())){
                                payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                            }
                        }
                        payee.setRebateAmt(feeAmt);//返利金额
                        if(StringUtils.isBlank(payee.getPurpCdNm())){
                            payee.setPurpCdNm(kv.getValue());
                        }
                        payeeList.add(payee);
                        purpList.add(payee.getPurpCd());
                    }
                }
            }
            mav.addObject("payeeList", payeeList);
            mav.addObject("accSize", purpList);
            BaseLogUtils.info(logger,"toAddPage","放款流程.收款账号返回前台.payeeList:" + JSON.toJSONString(payeeList),CurrentThreadContext.getCurrentUserName());
        }

        String proIntId = request.getParameter("processInstanceId");//流程实例ID
        String procNm = request.getParameter("procNm");//流程定义名称
        String taskId = request.getParameter("taskId");//任务ID
        String taskDefKey = request.getParameter("taskDefKey");//任务KEY
        String taskNm = request.getParameter("taskNm");//任务名称
        String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
        if (taskNm!=null&&(taskNm.equals("信审审核")||
				taskNm.contains("信审审核抵押")||
				taskNm.contains("信审审核上牌抵押"))) {
			isAuditNode="1";
		}
        int guaraStatus = 1;//担保人操作按钮展示状
        if (taskNm!=null && (taskNm.contains("呈报人") || taskNm.equals("信审审核合同"))){
            mav.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
        }
        //轻卡、重卡优车、三方资管城配、新能源、重卡城配、重卡特殊等部分信审审核、信审员审核、信审上牌抵押节点
        if (StringUtils.isNotBlank(taskDefKey) && (taskDefKey.equals("FLOW_00000014_002_002_002") || taskDefKey.equals("FLOW_00000014_007_003_002")
			|| taskDefKey.equals("FLOW_00000014_007_004_002") || taskDefKey.equals("FLOW_0000_002_006_011") || taskDefKey.equals("FLOW_0000_002_003_011")
			|| taskDefKey.equals("FLOW_00000001_001_004_016") || taskDefKey.equals("FLOW_00000001_001_004_001") || taskDefKey.equals("FLOW_00000013_001_003_010")
			|| taskDefKey.equals("FLOW_00000013_001_002_001") || taskDefKey.equals("FLOW_00000013_001_002_016") || taskDefKey.equals("FLOW_00000001_001_001_016")
			|| taskDefKey.equals("FLOW_00000001_001_001_001") || taskDefKey.equals("FLOW_00000001_008_001_016") || taskDefKey.equals("FLOW_00000001_008_001_010"))){
				mav.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
        }
        if (StringUtils.isNotBlank(taskDefKey)){
        	if (PrjBscInfoConstant.VERIFY_DBR_CAN_PUSH_FLOW_NO.contains(taskDefKey)){
                guaraStatus = 2;
            }
        }
        mav.addObject("guaraStatus", guaraStatus);
        /**
		 * "信审遗留问题"字段修改标识（add by JL 20190819）
		 * [信审审核/信审审核上牌抵押/信审审核抵押/商务审批]节点均允许修改
		 */
		if (taskNm!=null && (taskNm.equals("信审审核") || taskNm.contains("信审审核上牌抵押") || taskNm.contains("信审审核抵押")
				 || taskNm.contains("商务部审核"))) {
			mav.addObject("mdf_AudRemainPro", "1"); //1 允许修改
		}

        /**
         * 以下特定流程的节点，有维护抵押信息权限
         * 新能源汽车正常放款流程(新能源汽车放款流程)-上传权证资料FLOW_00000013_002_001_014
         */
        if ("新能源汽车放款流程".equals(procNm) &&"FLOW_00000013_002_001_014".equals(taskDefKey)) {
            mav.addObject("canUpdateMtg", 1);
        }

        mav.addObject("isAuditNode", isAuditNode);
        mav.addObject("proIntId", proIntId);
        mav.addObject("procNm", procNm);
        mav.addObject("taskId", taskId);
        mav.addObject("taskDefKey", taskDefKey);
        mav.addObject("taskNm", taskNm);

        //是否显示合同通过意见
        String showHtOpn = request.getParameter("showHtOpn");
        if (StringUtils.isEmpty(showHtOpn)) showHtOpn = "0";
        //是否显示抵押通过意见
        String showDyOpn = request.getParameter("showDyOpn");
        if (StringUtils.isEmpty(showDyOpn)) showDyOpn = "0";
        //是否显示驳回意见
        String showRejOpn = request.getParameter("showRejOpn");
        if (StringUtils.isEmpty(showRejOpn)) showRejOpn = "0";

        mav.addObject("showHtOpn", showHtOpn);
        mav.addObject("showDyOpn", showDyOpn);
        mav.addObject("showRejOpn", showRejOpn);

        //by YAOXIURONG 17-9-1
        String QZTX = request.getParameter("QZTX");//起租提醒节点标识
        mav.addObject("QZTX", QZTX);

        //by YAOXIURONG 17-9-11
        String spFlag = request.getParameter("spFlag");//上牌标识 可以添加/修改
        String checkSp = request.getParameter("checkSp");//是否可以审核上牌信息标识 
        if (StringUtils.isNotEmpty(spFlag) || StringUtils.isNotEmpty(checkSp)) {
            if (StringUtils.isEmpty(spFlag)) {
                spFlag = "0";
            }
            String isExistSp = "";
            String spState = "0";
            Long prjPrdDtlId = vo.getPrjPrdDtlId();
            if (StringUtils.isNotEmpty(prjPrdDtlId)) {
                //查询上牌信息
                PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
                if (null == prjPrdLicInfoVO) {
                    isExistSp = "0";
                } else {
                    isExistSp = "1";
                }
                if (null != prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())) {
                    spState = "1";
                }
            }
            mav.addObject("spState", spState);
            mav.addObject("isExistSp", isExistSp);
        }
        mav.addObject("spFlag", spFlag);
        mav.addObject("checkSp", checkSp);
        
        //2018-1-24 yaoxiurong 新能源放款流程
        String dyFlag = request.getParameter("dyFlag");//抵押标识 可以添加/修改
        String checkDy = request.getParameter("checkDy");//是否可以审核抵押信息标识 
        if (StringUtils.isNotEmpty(dyFlag) || StringUtils.isNotEmpty(checkDy)) {
        	if (StringUtils.isEmpty(dyFlag)) {
        		dyFlag = "0";
        	}
        	String isExistDy = "";
        	String dyState = "0";
        	Long prjPrdDtlId = vo.getPrjPrdDtlId();
        	if (StringUtils.isNotEmpty(prjPrdDtlId)) {
        		//查询抵押信息
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
				PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdMtgVO:"+JSON.toJSONString(prjPrdMtgVO), CurrentThreadContext.getCurrentUserName());
        		if (null == prjPrdMtgVO) {
        			isExistDy = "0";
        		} else {
        			isExistDy = "1";
        		}
                if(null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
                    dyState = "1";
                }else if (null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_FOR_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
                    dyState = "2";
                }
        	}
        	mav.addObject("dyState", dyState);
        	mav.addObject("isExistDy", isExistDy);
        }
        mav.addObject("dyFlag", dyFlag);
        mav.addObject("checkDy", checkDy);
        
        
        mav.addObject("bizFlag", bizFlag);
        
        try {
			//工行卡贷征信  - by yaoxiurong
			String showCreditResult = request.getParameter("showCreditResult");//信审节点查询征信结果标识
			mav.addObject("showCreditResult", showCreditResult);
			if("1".equals(showCreditResult) && PrjBscInfoConstant.PRJ_TYP_CD_GHKD.equals(vo.getPrjTypCd())){
				String sendStatus = "";//征信发送状态
				InfTransLogQueryCondition itlQC = new InfTransLogQueryCondition();
				itlQC.setAction(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.Action.submitCredit.key());//提交征信查询
				itlQC.setPrjId(vo.getPrjId());
				itlQC.setPaySchId(vo.getPaySchId());
				itlQC.setFundRasInsId(171225242000321L);
				BaseLogUtils.info(logger, "toAddPage", "===查询征信发送结果Start===prjId:"+vo.getPrjId()+",paySchId:"+vo.getPaySchId(), CurrentThreadContext.getCurrentUserName());
				List<InfTransLogDTO> findTransLogs = this.transLogApi.findTransLogs(itlQC);
				BaseLogUtils.info(logger, "toAddPage", "===查询征信发送结果End===prjId:"+vo.getPrjId()+",paySchId:"+vo.getPaySchId(), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(findTransLogs)){
					InfTransLogDTO infTransLogDTO = findTransLogs.get(0);
					if(null!=infTransLogDTO){
						sendStatus = infTransLogDTO.getStatus();
					}
				}
				mav.addObject("sendStatus", sendStatus);//同步状态 unsent-未发送  success-发送成功  failure-发送失败
				mav.addObject("sendStatusNm", this.getStatusNm(sendStatus));

//				String aStatus = "";
//				String mStatus = "";
//				String rStatus = "";
//				String sStatus = "";
				if("success".equals(sendStatus)){
					List<Long> paySchIds = new ArrayList<Long>();
					paySchIds.add(vo.getPaySchId());
					BaseLogUtils.info(logger, "toAddPage", "===查询征信结果Start===prjId:"+vo.getPrjId());
					cmm.mid.core.framework.dto.MessageDTO<CreditDTO> queryCredit = this.tripartiteApi.queryCredit(171225242000321L, "icbc", vo.getPrjId(), paySchIds);
					BaseLogUtils.info(logger, "toAddPage", "===查询征信结果End===prjId:"+vo.getPrjId()+",queryCredit:"+JSON.toJSONString(queryCredit));
					if(null!=queryCredit && queryCredit.isSuccess()){
						CreditDTO creditDTO = queryCredit.getData();
						if(null!=creditDTO){
							String auditResult = creditDTO.getAuditResult();
							String auditDesc = creditDTO.getAuditDesc();
							mav.addObject("auditResult", auditResult);//审核结果
							mav.addObject("auditDesc", auditDesc);//审核描述
						}
					}
					/*BaseLogUtils.info(logger, "toAddPage", "===查询征信请求结果Start===prjId:"+vo.getPrjId()+",paySchId:"+vo.getPaySchId(), CurrentThreadContext.getCurrentUserName());
					MessageDTO<QueryCreditDTO> queryCredit = this.icbcApi.queryCredit(171225242000321L, "icbc", vo.getPrjId(), vo.getPaySchId());
					BaseLogUtils.info(logger, "toAddPage", "===查询征信请求结果End===prjId:"+vo.getPrjId()+",paySchId:"+vo.getPaySchId()+",queryCredit:"+JSON.toJSONString(queryCredit), CurrentThreadContext.getCurrentUserName());
					if(null!=queryCredit && null!=queryCredit.getData()){
						QueryCreditDTO queryCreditDTO = queryCredit.getData();
						aStatus = queryCreditDTO.getaStatus();
						mStatus = queryCreditDTO.getmStatus();
						rStatus = queryCreditDTO.getrStatus();
						sStatus = queryCreditDTO.getsStatus();
					}*/
				}
//				mav.addObject("aStatus", aStatus);//申请人
//				mav.addObject("aStatusNm", this.getStatusNm(aStatus));
//				mav.addObject("mStatus", mStatus);//配偶
//				mav.addObject("mStatusNm", this.getStatusNm(mStatus));
//				mav.addObject("rStatus", rStatus);//担保人1
//				mav.addObject("rStatusNm", this.getStatusNm(rStatus));
//				mav.addObject("sStatus", sStatus);//担保人2
//				mav.addObject("sStatusNm", this.getStatusNm(sStatus));
			}
		} catch (Exception e) {
			BaseLogUtils.info(logger, "toAddPage", "===查询征信异常===prjId:"+vo.getPrjId(), CurrentThreadContext.getCurrentUserName());
			e.printStackTrace();
		}

        if(StringUtils.isNotBlank(isNeedAddTime)&&("0".equals(isNeedAddTime)||"1".equals(isNeedAddTime))){
            PrjPrdDtlVO prjPrdDtlVO = null;
            if (null != vo.getPrjPrdDtlId()) {
                prjPrdDtlVO = prjPrdDtlService.selectById(vo.getPrjPrdDtlId());
                if (prjPrdDtlVO == null) {
                    mav.addObject("dueDt", "");
                } else {
                    mav.addObject("dueDt", prjPrdDtlVO.getDueDt() == null ? "" : DateUtils.formatDateToString(prjPrdDtlVO.getDueDt(), "yyyy-MM-dd"));
                }
            } else {
                mav.addObject("dueDt", "");
            }
            mav.addObject("isNeedAddTime",isNeedAddTime);
			}

            //轻卡事业部 查询项目来源 来源于商家APP不支持修改付款信息
            if(PropertiesCacheUtils.getProperty(SystemConstant.FL_QK_BU_ORG_CD).equals(vo.getBuOrgCd())){
                if(null!=prjBscInfoVO && StringUtils.isNotEmpty(prjBscInfoVO.getDsCd())
                        && PropertiesCacheUtils.getProperty(SystemConstant.FL_SHOP_QK_APP_CD).equals(prjBscInfoVO.getDsCd())){
                    mav.addObject("entrance",0);//付款信息不可编辑
                    mav.addObject("accCtrl",1);//收款账户信息不可编辑
                }
            }

            if (StringUtils.isNotBlank(isAllowPay) && "0".equals(isAllowPay)){
                mav.addObject("entrance",0);
                mav.addObject("accCtrl",1);
                mav.addObject("ctrlKey",3);
                mav.addObject("isAddBank",0);
                mav.addObject("isOrDefaultTime",0);
                mav.addObject("isModifyAmt",0);
                mav.addObject("isNeedAddTime",0);
                mav.addObject("operateInsPlc",0);
                mav.addObject("isAllowPay",0);
                mav.addObject("rcptUntIsMdf",0);
                mav.addObject("isAuditNode",0);
                mav.addObject("feeAmtAndDtIsMdf",0);
            }
		} catch (NumberFormatException e) {
			BaseLogUtils.info(logger, "toAddPage", "加载付款详情页面异常.capPayId:"+id,CurrentThreadContext.getCurrentUserName(),e);
			e.printStackTrace();
		} catch (Exception e) {
			BaseLogUtils.info(logger, "toAddPage", "加载付款详情页面异常.capPayId:"+id,CurrentThreadContext.getCurrentUserName(),e);
			e.printStackTrace();
		}
        BaseLogUtils.info(logger,"toAddPage","放款流程.返回前台.mav:" + JSON.toJSONString(mav),CurrentThreadContext.getCurrentUserName());
        return mav;
    }

    /**
	 * 状态
	 * 0：等待处理
	 * 1：查询通过
	 * 2：查询通过
	 * 3：放弃查询
	 * 9：未知错误，请联系系统管理员确认
	 */
    private String getStatusNm(String status){
    	if(StringUtils.isNotEmpty(status)){
    		if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.unsent.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.unsent.desc();
        	}else if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.failure.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.failure.desc();
        	}else if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.success.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.success.desc();
        	}else if("0".equals(status)){
        		return "等待处理";
        	}else if("1".equals(status)){
        		return "查询通过";
        	}else if("2".equals(status)){
        		return "查询不通过";
        	}else if("3".equals(status)){
        		return "放弃查询";
        	}else if("9".equals(status)){
        		return "未知错误，请联系系统管理员确认";
        	}else{
        		return "无";
        	}
    	}else{
    		return "无";
    	}
    }

    /**
     * 到租赁物详情页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toLeaseListPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toLeaseListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toLeaseListPage", "加载到租赁物详情页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayLeaseList");
        String paySchId = request.getParameter("paySchId");//支付表ID
        String taskDefKey = request.getParameter("taskDefKey");//商助审核GPS
        String isAllowPay = request.getParameter("isAllowPay");
        mav.addObject("isAllowPay",isAllowPay);
        mav.addObject("paySchId", paySchId);
        mav.addObject("taskDefKey", taskDefKey);

        return mav;
    }

    /**
     * 到历史付款页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toHisPayListPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toHisPayListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toHisPayListPage", "加载到历史付款页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayHisList");
        String id = request.getParameter("id");//付款ID
        String paySchId = request.getParameter("paySchId");//支付表ID
        mav.addObject("id", id);
        mav.addObject("paySchId", paySchId);
        //this.prepare(request,mav);
        return mav;
    }

    /**
     * 到付款资料页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toMateListPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toMateListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toMateListPage", "加载到付款资料页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayMateList");
        //付款ID
        String id = request.getParameter("id");
        if (StringUtils.isEmpty(id)) {
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款ID为空");
        }
        //付款状态
        String payStsCd = request.getParameter("payStsCd");
        //控制键 1.可上传、下载、删除 2.可验证 3.不可操作
        String ctrlKey = request.getParameter("ctrlKey");
        //产品明细ID，上传文件业务主键ID使用产品明细ID
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        //项目ID
        String prjId = request.getParameter("prjId");
        //客户ID
        String cstId = request.getParameter("cstId");
        //客户经理组织架构
        String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
        //项目类型
        String prjTypCd = request.getParameter("prjTypCd");
        //节点key
        String taskDefKey = request.getParameter("taskDefKey");
        //支付表号
         String paySchNo = request.getParameter("paySchNo");

        mav.addObject("id", id);
        mav.addObject("payStsCd", payStsCd);
        mav.addObject("ctrlKey", ctrlKey);
        mav.addObject("prjId", prjId);
        mav.addObject("cstId", cstId);
        mav.addObject("cstMgrOrgCd", cstMgrOrgCd);
        mav.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
        mav.addObject("prjTypCd", prjTypCd);
        mav.addObject("taskDefKey", taskDefKey);
        mav.addObject("paySchNo", paySchNo);
        if (StringUtils.isBlank(ctrlKey)) {
            mav.addObject("ctrlKey", "1");
        }
        mav.addObject("prjPrdDtlId", prjPrdDtlId);
        /*if (StringUtils.isNotBlank(prjTypCd)) {
            mav.addObject("prjTypCd", prjTypCd);
        } else {
            CapPayInfoVO vo = this.capPayInfoService.selectById(Long.valueOf(id));
            if (null != vo) {
                mav.addObject("prjTypCd", vo.getPrjTypCd());
            }
        }*/

        if(StringUtils.isNotEmpty(prjId)){
            PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
            if(null != prjBscInfoVO){
                //金融机构机构编码
                mav.addObject("insCode",prjBscInfoVO.getInsCode());
                //项目类型
                mav.addObject("prjTypCd",prjBscInfoVO.getPrjTypCd());
            }
        }
        return mav;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toModifyPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toModifyPage", "加载CapPayInfo Modify页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayInfoModify");
        //this.prepare(request,mav);

        String id = request.getParameter("id");
        CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(id));
        PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(capPayInfoVO.getPrjId());
        mav.addObject("isSplMfr", prjBscInfoVO.getIsSplMfr());
        mav.addObject("capPayInfoVO", capPayInfoVO);
        return mav;
    }

    //加载数据字典数据、传值等 ？
    public void prepare(HttpServletRequest request, ModelAndView mav) {

    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initCapPayInfoList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        //设置查询条件？
        String contNo = request.getParameter("contNo");//合同号
        String paySchNo = request.getParameter("paySchNo");//支付表号
        String buOrgCd = request.getParameter("buOrgCd");//事业部
        String prjTypCd = request.getParameter("prjTypCd");//项目类型
        String cstNm = request.getParameter("cstNm");//客户名称
        String actPayTmBg = request.getParameter("actPayTmBg");//实际付款时间开始
        String actPayTmEd = request.getParameter("actPayTmEd");//实际付款时间结束
        String payAmtMin = request.getParameter("payAmtMin");//付款金额 小
        String payAmtMax = request.getParameter("payAmtMax");//付款金额 大
        String payStsCd = request.getParameter("payStsCd");//付款状态
        String applyResCd = request.getParameter("applyResCd");//申请来源
        String cstMgrNm = request.getParameter("cstMgrNm");//客户经理
        String isFstCol = request.getParameter("isFstCol");//首期款代收
        String installmentCd = request.getParameter("installmentCd");//保险分期
        String prjId = request.getParameter("prjId");//项目ID 2017-4-1 YAOXIURONNG
        String payTypCd = request.getParameter("payTypCd");//付款类型 2017-6-14 YAOXIURONNG
        String insCode = request.getParameter("insCode");//第三方机构编号
        String isSplMfr = request.getParameter("isSplMfr");// 是否厂商业务
        String cstMgrRgnCd = request.getParameter("cstMgrRgnCd");// 所属区域
        String isInsBiz = request.getParameter("isInsBiz");//是否资管业务
        String rgnProvCd = request.getParameter("rgnProvCd");//业务归属 省
        String rgnCityCd = request.getParameter("rgnCityCd");//业务归属 城市
        String isAllAuth = request.getParameter("isAllAuth");// 是否全权限数据
        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotEmpty(cstMgrRgnCd)) {
            qc.setCstMgrRgnCd(cstMgrRgnCd);//所属区域
        }
        if (StringUtils.isNotEmpty(isSplMfr)) {
            qc.setIsSplMfr(Long.valueOf(isSplMfr));//第三方机构编号
        }
        if (StringUtils.isNotEmpty(insCode)) {
            qc.setInsCode(insCode);//第三方机构编号
        }
        if (StringUtils.isNotEmpty(prjId)) {
            qc.setPrjId(Long.valueOf(prjId));//项目ID 2017-4-1 YAOXIURONNG
        }
        if (StringUtils.isNotEmpty(payTypCd)) {
            qc.setPayTypCd(payTypCd);
        }
        if (StringUtils.isNotEmpty(payStsCd)) {
            qc.setPayStsCd(payStsCd);
        }
        if(StringUtils.isNotEmpty(applyResCd)){
        	qc.setApplyResCd(applyResCd);
        }
        if (StringUtils.isNotEmpty(cstMgrNm)) {
            qc.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotEmpty(isFstCol)) {
            qc.setIsFstCol(Integer.valueOf(isFstCol));
        }
        if (StringUtils.isNotEmpty(contNo)) {
            qc.setContNo(contNo);
        }
        if (StringUtils.isNotEmpty(paySchNo)) {
            qc.setPaySchNo(paySchNo);
        }
        if (StringUtils.isNotEmpty(buOrgCd)) {
            qc.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotEmpty(prjTypCd)) {
            qc.setPrjTypCd(prjTypCd);
        }
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(actPayTmBg)) {
            qc.setActPayTmBg(actPayTmBg);
        }
        if (StringUtils.isNotEmpty(actPayTmEd)) {
            qc.setActPayTmEd(actPayTmEd);
        }
        if (StringUtils.isNotEmpty(payAmtMin)) {
            qc.setActPayAmtMin(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMin)));
        }
        if (StringUtils.isNotEmpty(payAmtMax)) {
            qc.setActPayAmtMax(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMax)));
        }
        if (StringUtils.isNotEmpty(installmentCd)) {
        	qc.setInstallmentCd(installmentCd);
        }
        if (StringUtils.isNotEmpty(isInsBiz)) {
            qc.setIsInsBiz(Integer.valueOf(isInsBiz));
        }
        // 业务归属城市  rgnProvCd 省 rgnCityCd 市
        if (StringUtils.isNotEmpty(rgnProvCd)) {
            qc.setRgnProvCd(rgnProvCd);
        }

        if (StringUtils.isNotEmpty(rgnCityCd)) {
            qc.setRgnCityCd(rgnCityCd);
        }
        if (StringUtils.isNotEmpty(isAllAuth)) {
            qc.setIsAllAuth(isAllAuth);
        }

        page.setCondition(qc);

        BaseLogUtils.info(logger, "initCapPayInfoList", "初始化CapPayInfo列表页面数据.DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
        Pager pager = this.capPayInfoService.searchListPage(page);
        List<CapPayInfoVO> list = (List<CapPayInfoVO>) pager.getResultList();
        /**
         * 2017-6-27 by YAOXIURONG
         */
        String isCpFlow = request.getParameter("isCpFlow");
        if (StringUtils.isNotEmpty(isCpFlow) && CollectionUtils.isNotEmpty(list) && "1".equals(isCpFlow)) {
            for (CapPayInfoVO capPayInfoVO : list) {
                Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
                if (StringUtils.isNotEmpty(prjPrdDtlId)) {
                    //查询上牌信息
                    PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
                    if (null == prjPrdLicInfoVO) {
                        capPayInfoVO.setIsExistSp("0");
                    } else {
                        capPayInfoVO.setIsExistSp("1");
                    }
                    if (null != prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())) {
                        capPayInfoVO.setSpState("1");
                    } else {
                        capPayInfoVO.setSpState("0");
                    }
                    //查询抵押信息
                    PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
                    if (null == prjPrdMtgVO) {
                        capPayInfoVO.setIsExistDy("0");
                    } else {
                        capPayInfoVO.setIsExistDy("1");
                    }
                    if (null != prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())) {
                        capPayInfoVO.setDyState("1");
                    } else {
                        capPayInfoVO.setDyState("0");
                    }
                }
            }
        }

        //资管机构名称后添加业务线字典
        if (CollectionUtils.isNotEmpty(list)) {
            //业务线字典List
            List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");
            //查询第三方机构
            List<FriBaseInfoVO> friBaseInfoVOList = this.overdueService.getFriBaseInfoList();
            //根据金融机构业务线,设置金融机构名称展示字段值
            FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOList,bussinessLineDicList);
            if (CollectionUtils.isNotEmpty(friBaseInfoVOList)) {
                for (CapPayInfoVO capPayInfoVOTemp : list) {
                    if (StringUtils.isEmpty(capPayInfoVOTemp.getFundRasInsId())) {
                        continue;
                    }
                    for (FriBaseInfoVO friBaseInfoVOTemp : friBaseInfoVOList) {
                        if (StringUtils.isNotEmpty(friBaseInfoVOTemp.getId()) && StringUtils.isNotEmpty(friBaseInfoVOTemp.getFundRasInsNmShow())
                                && friBaseInfoVOTemp.getId().longValue() == capPayInfoVOTemp.getFundRasInsId().longValue()) {
                            capPayInfoVOTemp.setFundRasInsNm(friBaseInfoVOTemp.getFundRasInsNmShow());
                            break;
                        }
                    }
                }
            }
        }

        ListPageVO<CapPayInfoVO> listPage = new ListPageVO<CapPayInfoVO>(list, pager.getTotalCount());
        return listPage;
    }

    /**
     * 初始化历史付款列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initHisPayList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initHisPayList(HttpServletRequest request, HttpServletResponse response) {
        //设置查询条件？
        String id = request.getParameter("id");//付款ID
        String paySchId = request.getParameter("paySchId");//支付表ID
        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotBlank(id)) {
            qc.setExcludeId(Long.valueOf(id));//排除本次付款
        } else {
            BaseLogUtils.error(logger, "initHisPayList", "初始化历史付款列表出错：付款ID为空", CurrentThreadContext.getCurrentUserName());
            return null;
        }
        if (StringUtils.isNotBlank(paySchId)) {
            qc.setPaySchId(Long.valueOf(paySchId));
        } else {
            BaseLogUtils.error(logger, "initHisPayList", "初始化历史付款列表出错：付款支付表ID为空", CurrentThreadContext.getCurrentUserName());
            return null;
        }
        qc.setPayStsCd(CapPayInfoConstant.CODE_PAY_STS_CD_FIN);//付款状态：已付款

        BaseLogUtils.info(logger, "initHisPayList", "初始化历史付款列表.DATA:" + JSONObject.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
        List<CapPayeeInfoVO> list = this.capPayInfoService.searchHisList(qc);
        if (CollectionUtils.isNotEmpty(list)) {
            return new ListPageVO<CapPayeeInfoVO>(list, list.size());
        }
        return null;
    }

    /**
     * 初始化付款租赁物列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initLeaseList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initLeaseList(HttpServletRequest request, HttpServletResponse response) {
        //设置查询条件？
        String paySchId = request.getParameter("paySchId");//支付表ID
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");//项目产品明细ID
        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotBlank(paySchId)) {
            qc.setPaySchId(Long.valueOf(paySchId));
        }
        if (StringUtils.isNotEmpty(prjPrdDtlId)) {
            qc.setPrjPrdDtlId(Long.valueOf(prjPrdDtlId));
        }

        BaseLogUtils.info(logger, "initLeaseList", "初始化付款租赁物列表.DATA:" + JSONObject.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
        List<CapPayLeaseVO> list = this.capPayInfoService.searchLeaseList(qc);
        if (CollectionUtils.isNotEmpty(list)) {
            return new ListPageVO<CapPayLeaseVO>(list, list.size());
        }
        return null;
    }

    /**
     * 初始化上传资料列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initMateList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initMateList(HttpServletRequest request, HttpServletResponse response) {
        //付款ID
        String id = request.getParameter("id");
        //产品明细ID
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        //付款状态
        String payStsCd = request.getParameter("payStsCd");
        //资料配置编号
        String mateCfgCd = request.getParameter("mateCfgCd");
        //项目ID
        String prjId = request.getParameter("prjId");
        //项目类型
        String prjTypCd = request.getParameter("prjTypCd");
        //设置查询条件？
        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotBlank(id)) {
            qc.setId(Long.valueOf(id));
        }
        if (StringUtils.isNotEmpty(prjPrdDtlId)) {
            qc.setPrjPrdDtlId(Long.valueOf(prjPrdDtlId));
        }
        if (StringUtils.isNotBlank(payStsCd)) {
            qc.setPayStsCd(payStsCd);
        }
        if (StringUtils.isNotBlank(mateCfgCd)) {
            qc.setMateCfgCd(mateCfgCd);
        }
        if (StringUtils.isNotEmpty(prjId)) {
            qc.setPrjId(Long.valueOf(prjId));
        }
        if(StringUtils.isNotBlank(prjTypCd)){
            qc.setPrjTypCd(prjTypCd);
        }
        BaseLogUtils.info(logger, "initMateList", "初始化上传资料列表.DATA:" + JSONObject.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
        List<CapPayMaterialVo> list = this.capPayInfoService.searchMateList(qc);
        if (CollectionUtils.isNotEmpty(list)) {
            return new ListPageVO<CapPayMaterialVo>(list, list.size());
        }
        return null;
    }

    /**
     * 删除数据
     */
    @RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeCapPayInfoByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String ids = request.getParameter("ids");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "removeCapPayInfoByIds", "删除CapPayInfo数据,主键参数为空!", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        List<Long> idsList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idsList.add(Long.valueOf(object.toString()));
        }

        try {
            boolean success = this.capPayInfoService.removeByIds(idsList);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
                BaseLogUtils.info(logger, "removeCapPayInfoByIds", "删除CapPayInfo数据失败,ID:" + idsList.toString(), CurrentThreadContext.getCurrentUserName());
            }
            BaseLogUtils.info(logger, "removeCapPayInfoByIds", "删除CapPayInfo数据成功,ID:" + idsList.toString(), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.info(logger, "removeCapPayInfoByIds", "删除CapPayInfo数据失败,ID:" + idsList.toString() + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "removeCapPayInfoByIds", "删除CapPayInfo数据失败,系统错误.ID:" + idsList.toString() + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 得到一条记录
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getById.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getCapPayInfoById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "getCapPayInfoById", "获取CapPayInfo数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        try {
            CapPayInfoVO vo = this.capPayInfoService.selectById(Long.valueOf(id));
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
                BaseLogUtils.info(logger, "getCapPayInfoById", "获取CapPayInfo数据不存在,ID:" + id, CurrentThreadContext.getCurrentUserName());
            }
            result.setData(vo);
            BaseLogUtils.info(logger, "getCapPayInfoById", "获取CapPayInfo数据成功,ID:" + id, CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.info(logger, "getCapPayInfoById", "获取CapPayInfo数据失败,ID:" + id + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "getCapPayInfoById", "获取CapPayInfo数据失败,系统错误.ID:" + id + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/add.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addCapPayInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        CapPayInfoVO entity = null;//获取参数
        try {
            entity = this.getRequestParamForCapPayInfo(request);//获取参数
            Long id = this.capPayInfoService.add(entity);
            result.setData(id);
            BaseLogUtils.info(logger, "addCapPayInfo", "新增CapPayInfo数据成功,ID:" + id + ".DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "addCapPayInfo", "新增CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "addCapPayInfo", "新增CapPayInfo数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/modify.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modifyCapPayInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        CapPayInfoVO entity = null;
        try {
            entity = this.getRequestParamForCapPayInfo(request);
            BaseLogUtils.newLogger("modifyCapPayInfo.修改CapPayInfo信息." + JSONObject.toJSONString(entity)).info();
            if (entity == null || entity.getId() == null) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
                return result;
            }
            String updInsLoan = request.getParameter("updInsLoan");
            if (StringUtils.isNotEmpty(updInsLoan) && updInsLoan.equals("1")){
                if (entity.getIsOutInsLoan() == 1 && entity.getInsLoanTm() == null ) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("机构放款时间不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 1 && StringUtils.isEmpty(entity.getInsLoanSum())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("机构放款金额不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 0 && StringUtils.isEmpty(entity.getPayerAccNo())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("付款账户为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 0 && StringUtils.isEmpty(entity.getPayerBkNm())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("开户行名称不能为空！");
                    return result;
                }
            } else if (StringUtils.isNotEmpty(updInsLoan) && updInsLoan.equals("2")){
                if (StringUtils.isEmpty(entity.getIsOutInsLoan())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("是否外部机构放款不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 1 && StringUtils.isEmpty(entity.getLoanInsCode())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("放款机构名称不能为空！");
                    return result;
                }
            }
            String payerStatusCd = request.getParameter("payerStatusCd");
            String isAddPayerStatusCd = request.getParameter("isAddPayerStatusCd");
            String thdPayAmt = request.getParameter("thdPayAmt");
            String thdPayDt = request.getParameter("thdPayDt");
            if (StringUtils.isNotBlank(isAddPayerStatusCd)) {
                if ("1".equals(isAddPayerStatusCd)) {
                    if (StringUtils.isBlank(payerStatusCd)) {
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                        BaseLogUtils.info(logger, "modifyCapPayInfo", "修改ModifyCrCardNo数据失败.DATA:" + "payerStatusCd is null", CurrentThreadContext.getCurrentUserName());
                        return result;
                    }else{
                        if(payerStatusCd.equals("2") && (StringUtils.isBlank(thdPayAmt) || StringUtils.isBlank(thdPayDt))){
                            result.setSuccess(BaseConstant.IS_YESNO_NO);
                            result.setInfo("请先维护页面中必填项数据.");
                            BaseLogUtils.info(logger, "modifyCapPayInfo", "修改ModifyCrCardNo数据失败.DATA:" + "payerStatusCd is null", CurrentThreadContext.getCurrentUserName());
                            return result;
                        }
                    }
                    String paySchId = request.getParameter("paySchId");
                    if (StringUtils.isBlank(paySchId)) {
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                        BaseLogUtils.info(logger, "modifyCapPayInfo", "修改PrjPrdPaySchM数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                        return result;
                    } else {
                        Long id = Long.valueOf(paySchId);
                        PrjPrdPaySchMVO prjPrdPaySchMVO = this.prjPrdPaySchMService.selectById(id);
                        if (null != prjPrdPaySchMVO) {
                            prjPrdPaySchMVO.setPayerStsCd(payerStatusCd);
                            if(StringUtils.isNotBlank(thdPayAmt)){
                                prjPrdPaySchMVO.setThdPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(thdPayAmt)));
                            }else{
                                prjPrdPaySchMVO.setThdPayAmt(null);
                            }
                            if(StringUtils.isNotBlank(thdPayDt)){
                                prjPrdPaySchMVO.setThdPayDt(DateUtils.formatStringToDate(thdPayDt, "yyyy-MM-dd"));
                            }else{
                                prjPrdPaySchMVO.setThdPayDt(null);
                            }
                            boolean flag = this.prjPrdPaySchMService.modifyCrCardNo(prjPrdPaySchMVO);
                            if (!flag) {
                                result.setSuccess(BaseConstant.IS_YESNO_NO);
                                result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                                BaseLogUtils.info(logger, "modifyCapPayInfo", "修改ModifyCrCardNo数据失败.DATA:" + JSONObject.toJSONString(prjPrdPaySchMVO), CurrentThreadContext.getCurrentUserName());
                                return result;
                            }
                        } else {
                            result.setSuccess(BaseConstant.IS_YESNO_NO);
                            result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                            BaseLogUtils.info(logger, "modifyCapPayInfo", "修改PrjPrdPaySchM数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                            return result;
                        }
                    }
                } else {
                    boolean success = this.capPayInfoService.modify(entity);
                    if (!success) {
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                        BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                        return result;
                    }
                }
            } else {
                boolean success = this.capPayInfoService.modify(entity);
                if (!success) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                    BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                    return result;
                }
            }

            //查询收款方信息
            CapPayeeInfoQueryCondition payeeInfoQueryCondition = new CapPayeeInfoQueryCondition();
            payeeInfoQueryCondition.setPayId(entity.getId());
            List<CapPayeeInfoVO> payeeVOList = capPayeeInfoService.searchList(payeeInfoQueryCondition);
            if (CollectionUtils.isNotEmpty(payeeVOList)) {
                List<KeyValueVO> kvList = new ArrayList<>(payeeVOList.size());
                KeyValueVO kv = null;
                for (CapPayeeInfoVO vo : payeeVOList) {
                    kv = new KeyValueVO();
                    if (StringUtils.isNotBlank(vo.getPurpCd())) {
                        kv.setKey(vo.getPurpCd());
                        kv.setValue(vo.getId() + "");
                    } else {
                        kv.setKey(CapitalConstant.CODE_SPL_BK_PURP_CD_1);
                        kv.setValue(vo.getId() + "");
                    }
                    kvList.add(kv);
                }
                result.setData(kvList);
            }
            BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo数据成功.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            BaseLogUtils.error(logger, "-", "异常", ex);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            BaseLogUtils.error(logger, "-", "异常", ex);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "modifyCapPayInfo", "修改CapPayInfo数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        BaseLogUtils.info(logger, "modifyCapPayInfo", "modifyCapPayInfo修改CapPayInfo数据.result:" + JSONObject.toJSONString(result), CurrentThreadContext.getCurrentUserName());
        return result;
    }

    /********************
     * 付款申请
     *******************/
    @RequestMapping(value = "/payApply.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object paymentApply(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = null;
        CapPayInfoVO entity = null;
        try {
            entity = this.getRequestParamForCapPayInfo(request);
            if (entity == null || entity.getId() == null) {
                result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                BaseLogUtils.info(logger, "paymentApply", "付款申请，修改CapPayInfo信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
                return result;
            }
            //获取当前操作用户的参数改为项目所属客户经理
            CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(entity.getId());
            BaseLogUtils.info(logger, "paymentApply", "付款申请，查询CapPayInfo信息,capPayInfoVO：" + JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
            if (capPayInfoVO != null) {
                if (capPayInfoVO.getCstMgrId() != null) {
                    entity.setCurrentUsrId(capPayInfoVO.getCstMgrId());
                    if (entity.getCrtUsrId() != null) {
                        entity.setCrtUsrId(capPayInfoVO.getCstMgrId());
                    }
                    if (entity.getMdfUsrId() != null) {
                        entity.setMdfUsrId(capPayInfoVO.getCstMgrId());
                    }
                }
            }
            String startExpatriateFlow = request.getParameter("startExpatriateFlow");
            BaseLogUtils.newWebLogger("随州垫款流程标识,startExpatriateFlow:" + startExpatriateFlow + ",entity" + JSON.toJSONString(entity)).info();
            entity.setPayStsCd(CapPayInfoConstant.CODE_PAY_STS_CD_START);//付款状态:申请中
            entity.setApplyResCd(CapPayInfoConstant.CODE_APPLY_RES_CD_3);//申请来源-PC
            result = this.capPayInfoService.payApply(entity);
            //放款流程发起成功-同步修改项目产品基础信息中的付款账号
            if(1 == result.getSuccess()) {
                // 重卡提前放款流程发起成功后同时发起垫款 增加垫款记录
                if (StringUtils.isNotEmpty(startExpatriateFlow) && "1".equals(startExpatriateFlow)
                        && SysBizFlowRlConstant.CODE_BIZ_FLOW_P_DEF_KEY_1.equals(entity.getFlowKey())) {
                    Long capPayId = entity.getId();
                    AdvBizRecQC advBizRecQC = new AdvBizRecQC();
                    advBizRecQC.setDataId(capPayId);
                    advBizRecQC.setIsDel(BaseConstant.IS_YESNO_NO);
                    advBizRecQC.setDataTypCd("CAP");
                    BaseLogUtils.newWebLogger("查询随州垫款流程记录发起Start,capPayId:" + capPayId + ",advBizRecQC:" + JSON.toJSONString(advBizRecQC)).info();
                    List<AdvBizRecVO> advBizRecVOS = this.advBizRecService.searchList(advBizRecQC);
                    BaseLogUtils.newWebLogger("查询随州垫款流程记录发起End,capPayId:" + capPayId + ",advBizRecVOS:" + JSON.toJSONString(advBizRecVOS)).info();
                    AdvBizRecVO advBizRec = new AdvBizRecVO();
                    advBizRec.setDataId(capPayId);
                    advBizRec.setDataTypCd("CAP");
                    advBizRec.setAdvStsCd("0");
                    advBizRec.setIsDel(BaseConstant.IS_YESNO_NO);
                    if (CollectionUtils.isNotEmpty(advBizRecVOS)) {
                        for (AdvBizRecVO advBizRecVO : advBizRecVOS) {
                            String advTypCd = advBizRecVO.getAdvStsCd();
                            if ("0".equals(advTypCd)) {
                                if (capPayInfoVO != null && capPayInfoVO.getCstMgrId() != null) {
                                    advBizRecVO.setMdfUsrId(capPayInfoVO.getCstMgrId());
                                } else {
                                    advBizRecVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                                }
                                advBizRecVO.setMdfTm(new Date());
                                boolean modify = this.advBizRecService.modify(advBizRecVO);
                                BaseLogUtils.newWebLogger("已存在待发起的随州垫款流程,capPayId:" + entity.getId() + ",modify:" + modify).info();
                            }
                            if ("1".equals(advTypCd)) {
                                throw new BaseException("随州垫款流程已发起，不可再次发起");
                            }
                            if ("2".equals(advTypCd)) {
                                throw new BaseException("随州垫款流程已完成，不可再次发起");
                            }
                        }
                    } else {
                        if (capPayInfoVO != null && capPayInfoVO.getCstMgrId() != null) {
                            advBizRec.setCrtUsrId(capPayInfoVO.getCstMgrId());
                        } else {
                            advBizRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                        }
                        advBizRec.setCrtTm(new Date());
                        BaseLogUtils.newWebLogger("随州垫款记录新增Start,capPayId:" + capPayId + ",advBizRec:" + JSON.toJSONString(advBizRec)).info();
                        Long id = this.advBizRecService.add(advBizRec);
                        if (StringUtils.isEmpty(id)) {
                            throw new BaseException("随州垫款记录新增失败！");
                        }
                        BaseLogUtils.newWebLogger("随州垫款记录新增End,capPayId:" + capPayId + ",id:" + id).info();
                    }
                }
            	boolean success = this.capPayInfoService.updateSplAccNoId(entity);
            	if(success) {
            		BaseLogUtils.info(logger, "paymentApply", "放款流程发起成功-同步修改项目产品基础信息中的付款账号==成功！", CurrentThreadContext.getCurrentUserName());
            	}else {
            		BaseLogUtils.info(logger, "paymentApply", "放款流程发起成功-同步修改项目产品基础信息中的付款账号==失败！", CurrentThreadContext.getCurrentUserName());
				}
            }
            BaseLogUtils.info(logger, "paymentApply", "修改CapPayInfo数据成功.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result = new DataResultVO(BaseConstant.IS_YESNO_NO);
            if (StringUtils.isNotBlank(ex.getMessage())){
                result.setInfo(ex.getMessage());
            }else{
                result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            }
            //result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "paymentApply", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "paymentApply", "修改CapPayInfo数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        BaseLogUtils.info(logger, "payApply", "payApply修改CapPayInfo数据.result:" + JSONObject.toJSONString(result), CurrentThreadContext.getCurrentUserName());
        return result;
    }

    /********************
     * 付款申请	17-8-9 by YAOXIURONG
     *******************/
    @RequestMapping(value = "/payApplyV2.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object paymentApplyV2(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        CapPayInfoVO entity = null;
        String procDefKey = request.getParameter("procDefKey");//流程定义KEY
        try {
            entity = this.getRequestParamForCapPayInfo(request);
            if (entity == null || entity.getId() == null) {
                result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                BaseLogUtils.info(logger, "paymentApplyV2", "付款申请，修改CapPayInfo信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
                return result;
            }
            entity.setPayStsCd(CapPayInfoConstant.CODE_PAY_STS_CD_START);//付款状态:申请中
            result = this.capPayInfoService.payApplyV2(result, entity, procDefKey);
            BaseLogUtils.info(logger, "paymentApplyV2", "修改CapPayInfo数据成功.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "paymentApplyV2", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result = new DataResultVO(BaseConstant.IS_YESNO_NO, SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "paymentApplyV2", "修改CapPayInfo数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /********************
     * 上传放款资料文件
     *******************/
    @RequestMapping(value = "/uploadMate.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object uploadMate(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_FILE_UPLOAD_SUCC);
        String fileParams = request.getParameter("fileParams");
        String cfgCd = request.getParameter("cfgCd");
        String cfgDtlCd = request.getParameter("cfgDtlCd");
        String id = request.getParameter("id");
        String orgCd = request.getParameter("orgCd");
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        String prjId = request.getParameter("prjId");
        if (StringUtils.isBlank(prjPrdDtlId)) {
            BaseLogUtils.error(logger, "uploadMate", "上传放款资料文件失败,主键产品明细ID为空==>cfgCd=" + cfgCd + ",cfgDtlCd=" + cfgDtlCd);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_FILE_UPLOAD_FAIL);
        } else {
            boolean flag = false;
            if (CapitalConstant.CODE_UL_PAY_FILE_CFG_CD.equals(cfgCd)) {
                //租赁物资料上传
                flag = this.sysUlFilesRecService.addAttchmnt(prjPrdDtlId, fileParams, cfgCd, cfgDtlCd, CapitalConstant.CODE_UL_TABLE_NM, null, null, null, false, orgCd);
                if (flag) {
                    result.setData(this.capPayInfoService.getPayMateCnt(prjPrdDtlId, orgCd));
                }
            } else {
                //狮桥对客合同+三方对客合同
                flag = this.sysUlFilesRecService.addAttchmnt(prjId, fileParams, cfgCd, cfgDtlCd, CapitalConstant.CODE_UL_TABLE_NM, null, null, null, false, orgCd);
            }
            if (!flag) {
                BaseLogUtils.error(logger, "uploadMate", "上传资料文件失败==>PRJ_PRD_DTL_ID=" + prjPrdDtlId + ",cfgCd=" + cfgCd + ",cfgDtlCd=" + cfgDtlCd + ",file=" + fileParams + ",prjId=" + prjId);
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_FILE_UPLOAD_FAIL);
                return result;
            }
            BaseLogUtils.info(logger, "uploadMate", "上传资料文件成功==>PRJ_PRD_DTL_ID=" + prjPrdDtlId + ",cfgCd=" + cfgCd + ",cfgDtlCd=" + cfgDtlCd + ",prjId=" + prjId);
        }
        return result;
    }

    /**
     * 修改放款资料的验证状态
     *
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/modifyAudStsCd.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO modifyMateStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        String fileId = request.getParameter("fileId");
        String audStsCd = request.getParameter("audStsCd");
        if (StringUtils.isEmpty(fileId)) {
            BaseLogUtils.info(logger, "modifyMateStsCd", "修改放款资料的验证状态==>资料ID为空");
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
            return result;
        }
        if (StringUtils.isBlank(audStsCd)) {
            BaseLogUtils.info(logger, "modifyMateStsCd", "修改放款资料的验证状态==>验证状态为空");
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
            return result;
        }
        boolean success = this.capPayInfoService.modifyMateStsCd(Long.valueOf(fileId), audStsCd);
        BaseLogUtils.info(logger, "modifyMateStsCd", "修改放款资料的验证状态,id=" + fileId + ",audStsCd=" + audStsCd + ",success=" + success, CurrentThreadContext.getCurrentUserName());
        if (!success) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
        }
        return result;
    }

    /**
     * 删除放款资料
     *
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/removeMate.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeMate(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        String fileId = request.getParameter("fileId");
        String id = request.getParameter("id");
        String orgCd = request.getParameter("orgCd");
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        if (StringUtils.isEmpty(fileId)) {
            BaseLogUtils.info(logger, "removeMate", "删除放款资料==>资料ID为空");
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
            return result;
        }

        boolean success = this.capPayInfoService.removeMate(Long.valueOf(fileId));
        BaseLogUtils.info(logger, "removeMate", "删除放款资料,id=" + fileId + ",success=" + success, CurrentThreadContext.getCurrentUserName());
        if (!success) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
        }
        if (StringUtils.isNotEmpty(prjPrdDtlId)) {
            result.setData(this.capPayInfoService.getPayMateCnt(prjPrdDtlId, orgCd));
        }
        return result;
    }


    /**
     * 导出
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/exportPayList.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public DataResultVO exportPayList(HttpServletRequest request, HttpServletResponse response) {
        //设置查询条件？
        String contNo = request.getParameter("contNo");//合同号
        String paySchNo = request.getParameter("paySchNo");//支付表号
        String buOrgCd = request.getParameter("buOrgCd");//事业部
        String prjTypCd = request.getParameter("prjTypCd");//项目类型
        String cstNm = request.getParameter("cstNm");//客户名称
        String actPayTmBg = request.getParameter("actPayTmBg");//实际付款时间开始
        String actPayTmEd = request.getParameter("actPayTmEd");//实际付款时间结束
        String payAmtMin = request.getParameter("payAmtMin");//付款金额 小
        String payAmtMax = request.getParameter("payAmtMax");//付款金额 大
        String payStsCd = request.getParameter("payStsCd");//付款状态
        String cstMgrNm = request.getParameter("cstMgrNm");//客户经理
        String isFstCol = request.getParameter("isFstCol");//首期款代收
        String applyResCd = request.getParameter("applyResCd");//申请来源
        String installmentCd = request.getParameter("installmentCd");//保险分期
        String insCode = request.getParameter("insCode");//第三方机构
        String isSplMfr = request.getParameter("isSplMfr");//厂商业务
        String isInsBiz = request.getParameter("isInsBiz");//是否资管业务
        CapPayInfoExportCondition qc = new CapPayInfoExportCondition();
        if (StringUtils.isNotEmpty(applyResCd)) {
            qc.setApplyResCd(applyResCd);
        }
        if (StringUtils.isNotEmpty(installmentCd)) {
            qc.setInstallmentCd(installmentCd);
        }
        if (StringUtils.isNotEmpty(insCode)) {
            qc.setInsCode(insCode);
        }
        if (StringUtils.isNotEmpty(isSplMfr)) {
            qc.setIsSplMfr(Long.valueOf(isSplMfr));
        }
        if (StringUtils.isNotEmpty(payStsCd)) {
            qc.setPayStsCd(payStsCd);
        }
        if (StringUtils.isNotEmpty(cstMgrNm)) {
            qc.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotEmpty(isFstCol)) {
            qc.setIsFstCol(Integer.valueOf(isFstCol));
        }
        if (StringUtils.isNotEmpty(contNo)) {
            qc.setContNo(contNo);
        }
        if (StringUtils.isNotEmpty(paySchNo)) {
            qc.setPaySchNo(paySchNo);
        }
        if (StringUtils.isNotEmpty(buOrgCd)) {
            qc.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotEmpty(prjTypCd)) {
            qc.setPrjTypCd(prjTypCd);
        }
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(actPayTmBg)) {
            qc.setActPayTmBg(actPayTmBg);
        }
        if (StringUtils.isNotEmpty(actPayTmEd)) {
            qc.setActPayTmEd(actPayTmEd);
        }
        if (StringUtils.isNotEmpty(payAmtMin)) {
            qc.setActPayAmtMin(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMin)));
        }
        if (StringUtils.isNotEmpty(payAmtMax)) {
            qc.setActPayAmtMax(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMax)));
        }
        if (StringUtils.isNotEmpty(isInsBiz)) {
            qc.setIsInsBiz(Integer.valueOf(isInsBiz));
        }
        BaseLogUtils.info(logger, "exportPayList", "查询导出付款申请的数据.DATA:" + JSONObject.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
        return this.capPayInfoService.exportPayList(qc);
    }

    /**
     * 获取请求参数
     *
     * @param request 请求
     * @return
     */
    private CapPayInfoVO getRequestParamForCapPayInfo(HttpServletRequest request) throws BaseException {
        //获取参数
        String id = request.getParameter("id");//主键
        String payStsCd = request.getParameter("payStsCd");//付款状态（CAP0008）: 未申请，申请中，已放款
        String payTypCd = request.getParameter("payTypCd");//付款类型（CAP0009）: 正常放款,提前付款,特殊放款
        String payer = request.getParameter("payer");//付款方
        String payerAccNo = request.getParameter("payerAccNo");//付款方银行账号
        String payerBkNm = request.getParameter("payerBkNm");//付款方开户行
        String payAmt = request.getParameter("payAmt");//应付金额
        String payRem = request.getParameter("payRem");//付款备注
        String isFstCol = request.getParameter("isFstCol");//是否代收首付款
        /*String payee = request.getParameter("payee");//收款方*/
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");//项目产品明细ID,流程发起成功之后添加产品明细 2017-02-13

        /*String payeeTypCd = request.getParameter("payeeTypCd");//收款方类型 1.供应商 2.承租人
        String bkId = request.getParameter("bkId");//供应商/承租人银行账户ID
        String rcptUnt = request.getParameter("rcptUnt");//收款单位/人
        String accNo = request.getParameter("accNo");//收款账号
        String actPayAmt = request.getParameter("actPayAmt");//实际付款金额
        String actPayTm = request.getParameter("actPayTm");//实际付款时间
        String payeeId = request.getParameter("payeeId");//收款方ID
        String bkAccTypCd = request.getParameter("bkAccTypCd");//银行账户类型
        String payeeBkNm = request.getParameter("payeeBkNm");//收款方开户行
        String payeeBkNo = request.getParameter("payeeBkNo");//开户行号
        String payWayCd = request.getParameter("payWayCd");//支付方式*/
        String prjId = request.getParameter("prjId");
        String paySchId = request.getParameter("paySchId");
        String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
        String prjPrdId = request.getParameter("prjPrdId");
        String buOrgCd = request.getParameter("buOrgCd");

        String payeeList = request.getParameter("payeeList");//收款方集合字符串
        String flowKey = request.getParameter("flowKey");//流程定义key
        String isOutInsLoan = request.getParameter("isOutInsLoan");//是否外部机构放款
        String insLoanTm = request.getParameter("insLoanTm");//机构放款时间
        String loanInsCode = request.getParameter("loanInsCode");//放款机构code
        String insLoanSum = request.getParameter("insLoanSum");//机构放款金额
        String loanInsNm = request.getParameter("loanInsNm");//放款机构名称

        //验证参数并赋值
        CapPayInfoVO entity = new CapPayInfoVO();
        if (StringUtils.isNotBlank(flowKey)) {
            entity.setFlowKey(flowKey);
        }
        if (StringUtils.isNotBlank(isOutInsLoan)) {
            entity.setIsOutInsLoan(Integer.valueOf(isOutInsLoan));
        }
        if (StringUtils.isNotBlank(insLoanTm)) {
            entity.setInsLoanTm(DateUtils.formatStringToDate(insLoanTm, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotBlank(loanInsCode)) {
            entity.setLoanInsCode(loanInsCode);
        }
        if (StringUtils.isNotBlank(insLoanSum)) {
            NumberFormat format = NumberFormat.getInstance();
            try {
                Double doubleValue = format.parse(insLoanSum).doubleValue();
                Long round = Math.round(doubleValue * 100);
                entity.setInsLoanSum(round);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        if (StringUtils.isNotBlank(loanInsNm)) {
            entity.setLoanInsNm(loanInsNm);
        }

        List<CapPayeeInfoVO> payeeInfoVOList = null;
        if (StringUtils.isNotBlank(payeeList)) {
            try {
                BaseLogUtils.info(logger, "transferCapPayInfoBegin", "转换前信息修改付款信息：" + JSON.toJSONString(payeeList), CurrentThreadContext.getCurrentUserName());
                payeeInfoVOList = JSON.parseArray(payeeList, CapPayeeInfoVO.class);
                for (CapPayeeInfoVO vo : payeeInfoVOList) {
                    if (StringUtils.isBlank(vo.getPurpCd())) {
                        vo.setPurpCd(CapitalConstant.CODE_SPL_BK_PURP_CD_1);
                    }
                    if (StringUtils.isNotEmpty(vo.getPayeeId())) {
                        vo.setId(vo.getPayeeId());
                        vo.setMdfTm(new Date());
                        vo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    }else{
                        vo.setCrtTm(new Date());
                        vo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                }
                    if (StringUtils.isNotBlank(vo.getActPayTms())) {
                        vo.setActPayTm(DateUtils.formatStringToDate(vo.getActPayTms(), DateUtils.YYYY_MM_DD));
                    }
                }
                BaseLogUtils.info(logger, "transferCapPayInfoEnd", "转换后修改付款信息：" + JSON.toJSONString(payeeList), CurrentThreadContext.getCurrentUserName());
            } catch (Exception e) {
                BaseLogUtils.error(logger, "-", "异常", e);
                return null;
            }
        } else {
            return null;
        }
        if (CollectionUtils.isNotEmpty(payeeInfoVOList)) {
            entity.setPayeeList(payeeInfoVOList);
        }

        if (StringUtils.isNotEmpty(prjId)) {
            entity.setPrjId(Long.valueOf(prjId));
        }
        if (StringUtils.isNotEmpty(paySchId)) {
            entity.setPaySchId(Long.valueOf(paySchId));
        }

        if (StringUtils.isNotBlank(cstMgrOrgCd)) {
            entity.setCstMgrOrgCd(cstMgrOrgCd);
        }

        if (StringUtils.isNotEmpty(prjPrdId)) {
            entity.setPrjPrdId(Long.valueOf(prjPrdId));
        }

        if (StringUtils.isNotBlank(buOrgCd)) {
            entity.setBuOrgCd(buOrgCd);
        }

        entity.setCurrentUsrId(CurrentThreadContext.getCurrentUserId());
        /*if (CollectionUtils.isNotEmpty(payeeInfoVOList)) {
            //收款方信息
            CapPayeeInfoVO payeeInfoVO = new CapPayeeInfoVO();
            if (StringUtils.isNotEmpty(payeeId)) {
                payeeInfoVO.setId(Long.valueOf(payeeId));
            }
            if (StringUtils.isNotBlank(bkAccTypCd)) {
                payeeInfoVO.setBkAccTypCd(bkAccTypCd);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,账户类型不能为空");
            }
            if (StringUtils.isNotBlank(payeeBkNm)) {
                payeeInfoVO.setPayeeBkNm(payeeBkNm);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,开户行不能为空");
            }
            if (StringUtils.isNotBlank(payeeBkNo)) {
                payeeInfoVO.setPayeeBkNo(payeeBkNo);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,开户行号不能为空");
            }
            if (StringUtils.isNotBlank(payWayCd)) {
                payeeInfoVO.setPayWayCd(payWayCd);
            }
            if (StringUtils.isNotBlank(accNo)) {
                payeeInfoVO.setAccNo(accNo);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款账户不能为空");
            }
            if (StringUtils.isNotBlank(payeeTypCd)) {
                payeeInfoVO.setPayeeTypCd(payeeTypCd);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款账户类型不能为空");
            }
            if (StringUtils.isNotBlank(bkId)) {
                payeeInfoVO.setBkId(Long.valueOf(bkId));
            }
            if (StringUtils.isNotBlank(rcptUnt)) {
                payeeInfoVO.setRcptUnt(rcptUnt);
            } else {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款单位(人)不能为空");
            }
            if (StringUtils.isNotBlank(actPayAmt)) {
                payeeInfoVO.setActPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(actPayAmt)));
            }
            if (StringUtils.isNotBlank(actPayTm)) {
                payeeInfoVO.setActPayTm(DateUtils.formatStringToDate(actPayTm, DateUtils.YYYY_MM_DD));
            }

            List<CapPayeeInfoVO> payees = new ArrayList<>();
            payees.add(payeeInfoVO);
            if (StringUtils.isBlank(payTypCd)) {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "付款类型不能为空.");
            }
            if (CollectionUtils.isNotEmpty(payees)) {
                entity.setPayeeList(payees);
            }
        } else {
            entity.setPayeeList(payeeInfoVOList);
        }*/

        /*if(StringUtils.isNotBlank(payStsCd)){
            if(CapPayInfoConstant.CODE_PAY_STS_CD_N_START.equals(payStsCd)){
                entity.setPayStsCd(CapPayInfoConstant.CODE_PAY_STS_CD_START);//付款状态（CAP0008）: 未申请，申请中，已放款
            }
        }else{
            entity.setPayStsCd(CapPayInfoConstant.CODE_PAY_STS_CD_START);//付款状态（CAP0008）: 未申请，申请中，已放款
        }*/
        entity.setPayTypCd(payTypCd);//付款类型（CAP0009）: 正常放款,提前付款,特殊放款
        entity.setPayer(payer);//付款方
        entity.setPayerAccNo(payerAccNo);//付款方银行账号
        entity.setPayerBkNm(payerBkNm);//付款方开户行

        try {
            if (StringUtils.isNotEmpty(payAmt)) {//应付金额
                //entity.setPayAmt(DecimalUtils.convertYuanToFen(Double.parseDouble(payAmt.trim().replace(",", ""))));
                entity.setPayAmt(Long.valueOf(payAmt));
            }
        } catch (NumberFormatException e) {
            entity.setPayAmt(Long.valueOf(payAmt.trim().replace(",", "")));
        }
        entity.setPayRem(payRem);//付款备注
        if (StringUtils.isNotEmpty(prjPrdDtlId)) {
            entity.setPrjPrdDtlId(Long.valueOf(prjPrdDtlId));
        }

        if (StringUtils.isNotBlank(isFstCol)) {
            if ("true".equals(isFstCol)) {
                entity.setIsFstCol(1);
            } else {
                entity.setIsFstCol(0);
            }
        }

        Date tm = new Date();
        if (StringUtils.isNotBlank(id)) {
            entity.setId(Long.valueOf(id));
            entity.setMdfTm(tm);
            entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
        } else {
            entity.setCrtTm(tm);
            entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        }

        return entity;
    }
    
   
    /**
     * 到专车客车信息补充页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toMwssagelPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toMwssagelPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toMwssagelPage", "加载到转测客车信息补充页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/mwssagelPage");
        String capPayInfoId = request.getParameter("id");
        CapPayInfoAddMessageQC qc = new CapPayInfoAddMessageQC();
        qc.setCapPayInfoId(Long.valueOf(capPayInfoId));
        List<CapPayInfoAddMessageVO> list = this.capPayInfoAddMessageService.searchList(qc);
        CapPayInfoAddMessageVO vo = new CapPayInfoAddMessageVO();
        if (CollectionUtils.isNotEmpty(list)) {
        	String mailingDt = null;
        	for (CapPayInfoAddMessageVO capPayInfoAddMessageVO : list) {
        		if (capPayInfoAddMessageVO.getMailingDt() != null){
        			mailingDt = DateUtils.formatDateToString(capPayInfoAddMessageVO.getMailingDt(), DateUtils.YYYY_MM_DD);
        			capPayInfoAddMessageVO.setMailingDts(mailingDt);
        		}
        		vo = capPayInfoAddMessageVO;
        	}
        	mav.addObject("CapPayInfoAddMessageVO",vo);
        }
        //是否
  		List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
  		mav.addObject("yesOrNOList", yesOrNOList);
        mav.addObject("capPayInfoId", capPayInfoId);
        return mav;
    }
    
  
    
    /**
     * 补充信息添加操作
     */
    @RequestMapping(value = "/mwssageAdd.do", method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public Object rejectAdd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
    	DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
    	String id = request.getParameter("id");
    	CapPayInfoAddMessageVO entity = null;//获取参数
    	try {
    		if (StringUtils.isNotBlank(id)) {
    			entity = this.getRequestParamForMwssageAdd(request);//获取参数
    			entity.setId(Long.valueOf(id));
    			boolean a = this.capPayInfoAddMessageService.modify(entity);//修改
    			if(a == true){
    				BaseLogUtils.info(logger, "rejectAdd", "修改CapPayInfoAddMessage数据成功,ID:" + id + ".DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
    			}
    		}else if(StringUtils.isBlank(id)) {
    			entity = this.getRequestParamForMwssageAdd(request);//获取参数
        		Long addId =this.capPayInfoAddMessageService.add(entity);
        		result.setData(addId);
        		BaseLogUtils.info(logger, "rejectAdd", "新增CapPayInfoAddMessage数据成功,ID:" + id + ".DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
    	} catch (BaseException ex) {
    		result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "rejectAdd", "新增CapPayInfoAddMessage数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
    	} catch (Exception ex) {
    		result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "rejectAdd", "新增CapPayInfoAddMessage数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
    	}
    	return result;
    }
    
  //获取补充信息参数
    private CapPayInfoAddMessageVO getRequestParamForMwssageAdd(HttpServletRequest request) throws BaseException{
    	//获取参数
        String accepterNm = request.getParameter("accepterNm");//接收人名字
        String capPayInfoId = request.getParameter("capPayInfoId");//付款信息表ID
        String mailingDt = request.getParameter("mailingDt");//接收时间
        String remark = request.getParameter("remark");//备注
        String standbyKey = request.getParameter("standbyKey");//备用要是是否收回
        String mailNumber = request.getParameter("mailNumber");//邮寄编号
        CapPayInfoAddMessageVO entity = new CapPayInfoAddMessageVO();
        Date regDate = null;
        regDate = DateUtils.formatStringToDate(mailingDt, DateUtils.YYYY_MM_DD);
        
        entity.setAccepterNm(accepterNm);
        entity.setCapPayInfoId(Long.valueOf(capPayInfoId));
        entity.setMailingDt(regDate);
        entity.setRemark(remark);
        entity.setStandbyKey(Integer.valueOf(standbyKey));
        entity.setMailNumber(mailNumber);
        return entity;
	}

    /**
     * 专车事业部到新增页面
     * add by jiangzg
     * 2017-8-23 09:19:12
     */
    @RequestMapping(value = "/toAddPageBySpecialCar.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPageBySpecialCar(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toAddPageBySpecialCar", "加载toAddPageBySpecialCar Add页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayInfoSpecialCarModify");
        String isAuditNode = request.getParameter("isAuditNode");//信审标识
        String isGpsNode = request.getParameter("isGpsNode");
        String taskNm = request.getParameter("taskNm");//任务名称
        String updInsLoan = request.getParameter("updInsLoan");//是否可修改外部机构放款
        if (taskNm!=null&&(taskNm.equals("信审审核")||
				taskNm.contains("信审审核抵押")||
				taskNm.contains("信审审核上牌抵押"))) {
			isAuditNode="1";
		}
        mav.addObject("isAuditNode",isAuditNode);

        /**
		 * "信审遗留问题"字段修改标识（add by JL 20190819）
		 * [信审审核/信审审核上牌抵押/信审审核抵押/商务审批]节点均允许修改
		 */
		if (taskNm!=null && (taskNm.equals("信审审核") || taskNm.contains("信审审核上牌抵押") || taskNm.contains("信审审核抵押")
				 || taskNm.contains("商务审核"))) {
			mav.addObject("mdf_AudRemainPro", "1"); //1 允许修改
		}

        String sysCd = CurrentThreadContext.getCurrentSysCd();
		String orgCd = CurrentThreadContext.getCurrentOrgCd();
        String showHtOpn1 = request.getParameter("showHtOpn");//区分提前放款两个信审节点
        String id = request.getParameter("id");//付款ID
        String payTypCd = request.getParameter("payTypCd");//付款类型
        String entrance = request.getParameter("entrance");//付款信息控制：付款时间、付款金额、付款方式 是否可编辑 0.都不可编辑 1.都可编辑 2.只能编辑付款金额 3.只能编辑供应商返利金额
        String accCtrl = request.getParameter("accCtrl");//收款账号控制：是否可编辑 0：可编辑 1.不可编辑
        //String btnCtrl = request.getParameter("btnCtrl");//按钮控制
        String ctrlKey = request.getParameter("ctrlKey");//控制资料上传审核 1.可上传编辑 2.审核 3.不可操作
        String isModifyAmt = request.getParameter("isModifyAmt");//控制是否需要输入真实保险金额、真实购置税 0.不可编辑 1.可编辑 2.不显示
        String isNeedAddTime = request.getParameter("isNeedAddTime"); //控制交车日期的填写 0.不可编辑 1.可编辑 2、不显示
        String rcptUntIsMdf = request.getParameter("rcptUntIsMdf"); // 0:都不可编辑 1:收款账户可编辑 2：返利账户可编辑 3：gps返利可编辑 4：保险可编辑 5：购置税可编辑 6、可修改上牌账户 all:都可修改
        String feeAmtAndDtIsMdf = request.getParameter("feeAmtAndDtIsMdf");
        // 0:都不可编辑 1:可以修改车款的实付时间和金额 2：可以修改供应商返利的实付时间和金额 3：可以修改gps返利的实付时间和金额 4：可以修改保险的实付时间和金额 5：可以修改购置税的实付时间和金额 6、可修改上牌实付时间和金额 all:都可修改
        String taskDefKey1 = request.getParameter("taskDefKey");//所属节点
        String rcptUntUnionMdf = request.getParameter("rcptUntUnionMdf");
        String authNm = request.getParameter("authNm");//控制信审审核抵押节点抵押权人名称
        String procDefId = request.getParameter("procDefId");//流程名称
        String grpBiz = request.getParameter("grpBiz");//专车控制是否团单
        String historyGrpBiz = request.getParameter("history_grpBiz");//history_grpBiz区分之前流程中的团单，和更改后流程中的团单
        String operateInsPlc = request.getParameter("operateInsPlc");//是否可操作保单
        String isAllowPay = request.getParameter("isAllowPay");//是否可发起流程
        String taskDefKey = request.getParameter("taskDefKey");//任务KEY
        int taskDefKeyA = 1;
        int guaraStatus = 1;//担保人操作按钮展示状态
        if(taskDefKey1 != null){
        if (taskDefKey1.equals("FLOW_00000008_002_002_031") || taskDefKey1.equals("FLOW_00000008_007_002_035")) {
        	taskDefKeyA = 2;
        }
        }
        if (StringUtils.isNotBlank(taskDefKey1)){
        	if (taskDefKey1.equals("FLOW_00000008_007_002_002") || taskDefKey1.equals("FLOW_00000008_007_002_011")
        			|| taskDefKey1.equals("FLOW_00000008_007_002_034")){
        		taskDefKeyA = 3;//放款前后信审节点显示，放款合同通过意见按钮
        	}
        }
        if (StringUtils.isNotBlank(taskDefKey1)){
        	if (taskDefKey1.equals("FLOW_00000008_007_002_002") || taskDefKey1.equals("FLOW_00000008_007_002_011")
        			|| taskDefKey1.equals("FLOW_00000008_007_002_034") || taskDefKey1.equals("FLOW_00000008_002_002_003")
        			|| taskDefKey1.equals("FLOW_00000008_002_002_028")){
        		taskDefKeyA = 3;//放款前后信审节点显示，放款合同通过意见按钮
        	}
            if (PrjBscInfoConstant.VERIFY_DBR_CAN_PUSH_FLOW_NO.contains(taskDefKey1)){
                guaraStatus = 2;
            }
        }
        if (StringUtils.isNotBlank(isAllowPay)){
            mav.addObject("isAllowPay", isAllowPay);
        }
        mav.addObject("guaraStatus", guaraStatus);
        mav.addObject("operateInsPlc",operateInsPlc);//付款申请单，允许修改、删除保单信息
        if (taskNm!=null && (taskNm.contains("呈报人") || taskNm.equals("信审审核合同"))){
            mav.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
        }
        //轻卡、重卡优车、三方资管城配、新能源、重卡城配、重卡特殊等部分信审审核、信审员审核、信审上牌抵押节点
        if (StringUtils.isNotBlank(taskDefKey1) && (taskDefKey1.equals("FLOW_00000014_002_002_002") || taskDefKey1.equals("FLOW_00000014_007_003_002")
			|| taskDefKey1.equals("FLOW_00000014_007_004_002") || taskDefKey1.equals("FLOW_0000_002_006_011") || taskDefKey1.equals("FLOW_0000_002_003_011")
			|| taskDefKey1.equals("FLOW_00000001_001_004_016") || taskDefKey1.equals("FLOW_00000001_001_004_001") || taskDefKey1.equals("FLOW_00000013_001_003_010")
			|| taskDefKey1.equals("FLOW_00000013_001_002_001") || taskDefKey1.equals("FLOW_00000013_001_002_016") || taskDefKey1.equals("FLOW_00000001_001_001_016")
			|| taskDefKey1.equals("FLOW_00000001_001_001_001") || taskDefKey1.equals("FLOW_00000001_008_001_016") || taskDefKey1.equals("FLOW_00000001_008_001_010"))){
				mav.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
        }
        //为兼容老数据，资金部审核节点，设置updInsLoan=2
        Boolean isOld = false;
        if (StringUtils.isNotEmpty(taskDefKey) && ("FLOW_00000001_002_001_079".equals(taskDefKey)
                || "FLOW_00000001_007_001_083".equals(taskDefKey) || "FLOW_00000001_007_002_081".equals(taskDefKey)
                || "FLOW_00000001_001_001_090".equals(taskDefKey) || "FLOW_00000008_002_002_049".equals(taskDefKey)
                || "FLOW_00000008_007_002_052".equals(taskDefKey))){
            updInsLoan = "2";
            isOld = true;
        }
        if (StringUtils.isEmpty(updInsLoan)) updInsLoan = "0";
        mav.addObject("updInsLoan", updInsLoan);
        //组合修改 账户信息 0:都不可编辑
        String feeAmtAndDtUnionMdf = request.getParameter("feeAmtAndDtUnionMdf");
        //组合修改 实付时间及金额 0:都不可编辑
        PrjBscInfoVO  prjBscInfoVO = null;
        if (StringUtils.isBlank(feeAmtAndDtIsMdf)) {
            feeAmtAndDtIsMdf = "0";
        }

        if (StringUtils.isBlank(entrance)) {
            entrance = "0";
        }
        if (StringUtils.isBlank(accCtrl)) {
            accCtrl = "1";
        }
        if (StringUtils.isBlank(ctrlKey)) {
            ctrlKey = "1";
        }
        if (StringUtils.isBlank(isModifyAmt)) {
            isModifyAmt = "0";
        }
        if (StringUtils.isBlank(isNeedAddTime)) {
            isNeedAddTime = "0";
        }
        if (StringUtils.isBlank(rcptUntIsMdf)) {
            rcptUntIsMdf = "0";
        }
        if(StringUtils.isBlank(rcptUntUnionMdf)){
            rcptUntUnionMdf = "0";
        }
        if(StringUtils.isBlank(feeAmtAndDtUnionMdf)){
            feeAmtAndDtUnionMdf = "0";
        }
        if (StringUtils.isBlank(historyGrpBiz)) {
        	historyGrpBiz = "0";
        }
        if (StringUtils.isBlank(grpBiz)) {
        	grpBiz = "0";
        }
        mav.addObject("taskDefKey1", taskDefKeyA);
        mav.addObject("id", id);
        mav.addObject("payTypCd", payTypCd);
        mav.addObject("entrance", entrance);
        mav.addObject("accCtrl", accCtrl);
        mav.addObject("ctrlKey", ctrlKey);
        mav.addObject("isModifyAmt", isModifyAmt);
        mav.addObject("isNeedAddTime", isNeedAddTime);
        mav.addObject("rcptUntIsMdf", rcptUntIsMdf);
        mav.addObject("feeAmtAndDtIsMdf", feeAmtAndDtIsMdf);
        mav.addObject("rcptUntUnionMdf", rcptUntUnionMdf);
        mav.addObject("feeAmtAndDtUnionMdf", feeAmtAndDtUnionMdf);
        mav.addObject("showHtOpn1", showHtOpn1);
        mav.addObject("authNm", authNm);
        mav.addObject("procDefId", procDefId);
        mav.addObject("grpBiz",grpBiz );//专车控制是否团单
        mav.addObject("historyGrpBiz", historyGrpBiz);
        mav.addObject("isGpsNode", isGpsNode);
        mav.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());

        //是否团单
        List<KeyValueVO> isGrpList = this.capPayInfoService.searchIsGrpList();
        mav.addObject("isGrpList", isGrpList);
        //是否
        List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
        mav.addObject("yesOrNOList", yesOrNOList);
        DecimalFormat df = new DecimalFormat("######0.00");//格式化保留两位小数
        //查询付款信息
        CapPayInfoVO vo = this.capPayInfoService.selectById(Long.valueOf(id));
        if (null == vo) {
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "未找到付款信息");
        }
        mav.addObject("loanInsCode",vo.getLoanInsCode());
        mav.addObject("loanInsNm",vo.getLoanInsNm());
        mav.addObject("isOutInsLoan",vo.getIsOutInsLoan());
        Date insLoanTm = vo.getInsLoanTm();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String dateStr = "";
        if (insLoanTm != null) {
            dateStr = sdf.format(insLoanTm);
        }
        mav.addObject("insLoanTm",dateStr);
        if (StringUtils.isNotEmpty(vo.getInsLoanSum())) {
            vo.setInsLoanSums(df.format(DecimalUtils.convertFenToYuan(vo.getInsLoanSum())));
        }
        mav.addObject("insLoanSum",vo.getInsLoanSums());

        //是否展示发送至录单员按钮：重卡事业部、二手车金融事业部、客车事业部、新能源事业部、轻卡事业部，未提交且未发送录单请求
        String showRec = "0";
        if (PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_ORG_CD_ESC.equals(vo.getBuOrgCd())
                || PrjBscInfoConstant.CODE_BU_ORG_CD_ZC.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(vo.getBuOrgCd())
                || PrjBscInfoConstant.CODE_BU_ORG_CD_QK.equals(vo.getBuOrgCd())) {
            if (CapitalConstant.CODE_CAP_PAY_STS_CD_1.equals(vo.getPayStsCd())) {
                //查询台账
                AuditStandingBookQueryCondition bookQueryCondition = new AuditStandingBookQueryCondition();
                bookQueryCondition.setPayId(vo.getId());
                bookQueryCondition.setBookTypeCd(AudStandingBookConstant.AUD_TYP_CD_FL);
                AudStandingBookListRequest audRequest = new AudStandingBookListRequest();
                audRequest.setCondition(bookQueryCondition);
                audRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
                audRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
                BaseLogUtils.newServiceLogger("付款申请查询台账信息 payId:" + vo.getId() + ",audRequest:" + JSON.toJSONString(audRequest)).info();
                ResponseData<List<AuditStandingBookDTO>> audResponse = this.auditStandingBookService.searchList(audRequest);
                BaseLogUtils.newServiceLogger("付款申请查询台账信息 payId:" + vo.getId() + ",audResponse:" + JSON.toJSONString(audResponse)).info();
                if (ResponseData.SUCCESS_CODE.equals(audResponse.getCode())) {
                    List<AuditStandingBookDTO> audResponseData = audResponse.getData();
                    if (CollectionUtils.isEmpty(audResponseData)) {
                        showRec = "1";
                    }
                }
                //校验当前用户是否被限制
                PrjFlowAuthCtrlQC strlQc = new PrjFlowAuthCtrlQC();
                strlQc.setIsValid(1);
                strlQc.setPassiveCtrlId(CurrentThreadContext.getCurrentUserId());
                strlQc.setFlowStartTm(DateUtils.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
                strlQc.setCtrlPrjTypCd(vo.getPrjTypCd());
                strlQc.setCtrlContent(PrjFlowAuthCtrlConstant.CTRL_CONTENT_2);
                //是否允许发送至录单员：0-禁止
                strlQc.setIsAllowSendToRecoder("0");
                BaseLogUtils.newLogger("付款申请.查询项目流程权限控制.payId:{},qc:{}", vo.getId(), JSON.toJSONString(strlQc)).info();
                List<PrjFlowAuthCtrlDTO> prjFlowAuthCtrlDTOS = prjFlowAuthCtrlService.searchList(strlQc);
                BaseLogUtils.newLogger("付款申请.查询项目流程权限控制.payId:{},result:{}", vo.getId(), prjFlowAuthCtrlDTOS.size()).info();
                if (CollectionUtils.isNotEmpty(prjFlowAuthCtrlDTOS) && prjFlowAuthCtrlDTOS.size() > 0) {
                    for (PrjFlowAuthCtrlDTO prjFlowAuthCtrlDTO : prjFlowAuthCtrlDTOS) {
                        if (StringUtils.isNotEmpty(CurrentThreadContext.getCurrentOrgCd()) && CurrentThreadContext.getCurrentOrgCd().startsWith(prjFlowAuthCtrlDTO.getPassiveCtrlOrgCd())) {
                            showRec = "0";
                        }
                    }
                }
            }
        }
        mav.addObject("showRec",showRec);
        //查询项目中   --是否需要抵押
        if(StringUtils.isNotEmpty(vo.getPrjId())){
            prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(vo.getPrjId()));
        }
        //系统判断方案审核结果
        if (prjBscInfoVO != null && prjBscInfoVO.getAuditInfo() != null){
            String auditInfo = prjBscInfoVO.getAuditInfo();
            if(StringUtils.isNotEmpty(auditInfo)){
                String replaceAll = auditInfo.replaceAll(">>", "</br>");
                mav.addObject("auditInfo", replaceAll);
            }
        }
        //是否展示银行信息采集：所属机构为建行 ccbanktb时，当前合同号下其余支付表号放款状态都不是“未申请”或者“放款失败”的时候，放款申请显示银行信息采集标签页
        String isShowAccTab = "0";
        if (PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(prjBscInfoVO.getInsCode())) {
            isShowAccTab = "1";
            CapPayInfoQueryCondition queryCondition = new CapPayInfoQueryCondition();
            queryCondition.setContNo(prjBscInfoVO.getLsCntNo());
            queryCondition.setExcludeId(vo.getId());
            queryCondition.setIsDel(0);
            List<CapPayInfoVO> capPayInfoVOS = capPayInfoService.searchList(queryCondition);
            BaseLogUtils.newWebLogger("查询付款数据：" + JSON.toJSONString(capPayInfoVOS)).info();
            for (CapPayInfoVO payInfoVO : capPayInfoVOS) {
                if (CapitalConstant.CODE_CAP_PAY_STS_CD_1.equals(payInfoVO.getPayStsCd())
                        || CapitalConstant.CODE_CAP_PAY_STS_CD_4.equals(payInfoVO.getPayStsCd())){
                    isShowAccTab = "0";
                }
            }
        }
        mav.addObject("isShowAccTab",isShowAccTab);

        FriBaseInfoQueryCondition friQc = new FriBaseInfoQueryCondition();
        friQc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
        friQc.setInsUseCd("3");
        friQc.setIsService(1);
        friQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
        friQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
        BaseLogUtils.newLogger("查询机构,friQc:{}", JSON.toJSONString(friQc)).info();
        List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(friQc);
        BaseLogUtils.newLogger("查询机构,prjId:{},friQc:{}",prjBscInfoVO.getId(), JSON.toJSONString(friBaseInfoVOList)).info();
        Map<String,String> map1 = new HashMap<>();
        if (CollectionUtils.isNotEmpty(friBaseInfoVOList)){
            friBaseInfoVOList.forEach( friBaseInfoVO -> {
                map1.put(friBaseInfoVO.getInsCode(),friBaseInfoVO.getIsOutPay());
                mav.addObject("friBaseMap", JSON.toJSONString(map1));
            });
        }

        //资金部审核节点查询机构
        if (null != vo.getPrjId() && StringUtils.isNotEmpty(vo.getProcDefKey())){
            BaseLogUtils.newLogger("调用规则引擎查询可用机构，prjId:{},ProcDefKey:{}",vo.getPrjId(),vo.getProcDefKey()).info();
            DataResultDTO dataResultDTO = capPayFlowApiService.getPrjInsFlowMatchRule(vo.getPrjId(),vo.getProcDefKey());
            BaseLogUtils.newLogger("调用规则引擎查询可用机构End，dataResultDTO:{}",JSON.toJSONString(dataResultDTO)).info();
            if (null != dataResultDTO && null != dataResultDTO.getData() && dataResultDTO.getSuccess() == 1){
                List<FriBaseInfoVO> friBaseInfoVOS = new ArrayList();
                //解析结果
                JSONObject result = (JSONObject) dataResultDTO.getData();
                if (result != null) {
                    JSONObject decisionResult = result.getJSONObject("decisionResult");
                    if (decisionResult != null) {
                        JSONObject param = decisionResult.getJSONObject("param");
                        if (param != null) {
                            JSONObject data = param.getJSONObject("data");
                            if (data != null) {
                                FriBaseInfoVO friBaseInfoVO = null;
                                for (Map.Entry<String, Object> entry : data.entrySet()) {
                                    friBaseInfoVO = new FriBaseInfoVO();
                                    friBaseInfoVO.setInsCode(entry.getKey());
                                    friBaseInfoVO.setFundRasInsNm(entry.getValue().toString());
                                    friBaseInfoVOS.add(friBaseInfoVO);
                                }
                            }
                        }
                    }
                }
                if (isOld){
                    BaseLogUtils.newLogger("老数据剔除平安佛山，friBaseInfoVOS：{}",JSON.toJSONString(friBaseInfoVOS)).info();
                    friBaseInfoVOS.stream().filter(fri -> "pafsbank".equals(fri.getInsCode())).collect(Collectors.toList());
                    BaseLogUtils.newLogger("老数据剔除平安佛山End，friBaseInfoVOS：{}",JSON.toJSONString(friBaseInfoVOS)).info();
                }
                mav.addObject("friBaseList", friBaseInfoVOS);
            }
        }

        mav.addObject("prjId", vo.getPrjId());

        CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectDetailById(vo.getCstId());
        if (DictionaryConstant.CODE_CERT_TYP_CD_0.equals(cstBscInfoVO.getCertTypCd())) {
            mav.addObject("certNo", cstBscInfoVO.getCertNo()); // 证件号码
        }
        //风险标记开始
        List<Long> prjPrdDtlIdList = new ArrayList<Long>();
        prjPrdDtlIdList.add(vo.getPrjPrdDtlId());
        Map<String,String> result = this.rskCstSignLogService.searchRskResInfo(vo.getCstId(),Long.valueOf(vo.getPrjId()),prjPrdDtlIdList);
        if(MapUtils.isNotEmpty(result)){
            //客户风险标记
            mav.addObject("rskCstSignDesc",result.get("rskCstSignDesc"));
            //设备风险标记
            mav.addObject("rskProdSignDesc", result.get("rskProdSignDesc"));
            //担保人风险标记
            mav.addObject("rskGuarSignDesc", result.get("rskGuarSignDesc"));
            //vin风险标记
            mav.addObject("rskVinSignDesc",result.get("rskVinSignDesc"));
            //承租人手机号风险标记
            mav.addObject("rskCstMpSignDesc", result.get("rskCstMpSignDesc"));
            //挂靠公司风险标记
            mav.addObject("rskLnkSignDesc", result.get("rskLnkSignDesc"));
            //供应商风险标记
            mav.addObject("rskSplSignDesc", result.get("rskSplSignDesc"));
        }else{
            //客户风险标记
            mav.addObject("rskCstSignDesc","");
            //设备风险标记
            mav.addObject("rskProdSignDesc", "");
            //担保人风险标记
            mav.addObject("rskGuarSignDesc", "");
            //vin风险标记
            mav.addObject("rskVinSignDesc","");
            //承租人手机号风险标记
            mav.addObject("rskCstMpSignDesc", "");
            //挂靠公司风险标记
            mav.addObject("rskLnkSignDesc", "");
            //供应商风险标记
            mav.addObject("rskSplSignDesc", "");
        }
        System.err.println(vo.getPrjId());
        //抵押信息
        if (StringUtils.isNotEmpty(vo.getPrjPrdDtlId())) {
        	mav.addObject("prjPrdDtlId",vo.getPrjPrdDtlId());
            PrjPrdMtgDetailRequest prjPrdMtgDetailRequest = new PrjPrdMtgDetailRequest();
            prjPrdMtgDetailRequest.setId(vo.getPrjPrdDtlId());
            prjPrdMtgDetailRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
            prjPrdMtgDetailRequest.setSysCd(CurrentThreadContext.getFlServiceSysCd());
            BaseLogUtils.info(logger,"toAddPageBySpecialCar","pre-loan 抵押根据id查询调用贷前服务开始");
            Long startTime = System.currentTimeMillis();
            ResponseData<cn.fl.preloan.dto.PrjPrdMtgDTO> responseData = productMortgateService.selectPrjPrdMtgById(prjPrdMtgDetailRequest);
            Long endTime = System.currentTimeMillis();
            BaseLogUtils.info(logger,"toAddPageBySpecialCar","pre-loan 抵押根据id查询调用贷前服务结束，耗时："+(endTime-startTime)+" ms" + " message: " + responseData.getMessage());
            PrjPrdMtgDTO prjPrdMtgDTO = new PrjPrdMtgDTO();
            BeanUtils.copyProperties(responseData.getData(),prjPrdMtgDTO);
//        PrjPrdMtgDTO prjPrdMtgDTO = this.projectApiService.selectPrjPrdMtgById(vo.getPrjPrdDtlId(),CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd());
        if (null != prjPrdMtgDTO && null != prjPrdMtgDTO.getGuarStsCd()) {
            mav.addObject("prjprdMtg", "1");
            mav.addObject("prjprdMtgInfo", PrjPrdMtgVOTransform.toVO(prjPrdMtgDTO));
            mav.addObject("prdMtgInfo",prjPrdMtgDTO.getPledgeState());
            mav.addObject("mtgWayCd",prjPrdMtgDTO.getMtgWayCd());
        } else {
            mav.addObject("prjprdMtg", "0");
            mav.addObject("prjprdMtgInfo", null);
        }
        if(null != prjPrdMtgDTO && StringUtils.isNotBlank(prjPrdMtgDTO.getPledgeeAuthNm())){
        	 String pledgeeAuthNm = prjPrdMtgDTO.getPledgeeAuthNm();//抵押权人名称
             mav.addObject("pledgeeAuthNm", pledgeeAuthNm);
        }
        }
		//抵押权人名称数据字典查询
		List<KeyValueVO> pledgeeNmList = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_PLEDGEE_NM, sysCd, orgCd);
		mav.addObject("pledgeeNmList", pledgeeNmList);
        mav.addObject("pledgeNm", prjBscInfoVO.getPledgeNm());
        mav.addObject("prjBscInfoVO", prjBscInfoVO);
        if(prjBscInfoVO != null && StringUtils.isNotBlank(prjBscInfoVO.getOpen()) ){
        	mav.addObject("opens", prjBscInfoVO.getOpen());
        }
        if (StringUtils.isNotEmpty(vo.getPrjPrdDtlId())) {
            //查询上牌信息
            PrjPrdLicInfoDTO prjdto = this.projectApiService.selectPrjPrdLicInfoById(vo.getPrjPrdDtlId(), CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd());
            if (null != prjdto && null != prjdto.getLicDt()) {
                mav.addObject("prdLicInfo", "1");
                mav.addObject("prjPrdLicInfo", PrjPrdLicInfoVOTransform.toVO(prjdto));
                mav.addObject("PrjLicInfo",prjdto.getVerification());
            } else {
                mav.addObject("prdLicInfo", "0");
                mav.addObject("prjPrdLicInfo", null);
            }
        }
        //放款类型为空判断
        if (StringUtils.isBlank(payTypCd)) {
            mav.addObject("payTypCd", vo.getPayTypCd());
        }
        PrjPrdDtlVO prjPrdDtlVO = null;
        if (null != vo.getPrjPrdDtlId()) {
            prjPrdDtlVO = prjPrdDtlService.selectById(vo.getPrjPrdDtlId());
            if (prjPrdDtlVO == null) {
                mav.addObject("dueDt", "");
            } else {
                mav.addObject("dueDt", prjPrdDtlVO.getDueDt() == null ? "" : DateUtils.formatDateToString(prjPrdDtlVO.getDueDt(), "yyyy-MM-dd"));
            }
        } else {
            mav.addObject("dueDt", "");
        }

        //Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
        vo = this.capPayInfoService.getPayInfoCount(vo);
        mav.addObject("capPayInfoVO", vo);

        //收款方类型 1:供应商 2:承租人 3:第三方 4:省公司 5:客户经理
        List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
        mav.addObject("payeeTypCdList", JSON.toJSONString(payeeTypCdList));
        //款项
        /*List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
        mav.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));*/
        //付款方式
        // 1	支票 2	现金 3	外付网银 4	商业汇票 5	银行汇票 6	坐扣 7	其他
        List<KeyValueVO> payWayCdList = this.capPayInfoService.getPayWayCdList();
        mav.addObject("payWayCdList", JSON.toJSONString(payWayCdList));
        //this.prepare(request,mav);
        //账户类型 0：对公 1：对私
        List<KeyValueVO> bkAccTypCdList = this.capPayInfoService.getBkAccTypCdList();
        mav.addObject("bkAccTypCdList", JSON.toJSONString(bkAccTypCdList));

        //查询收款方信息
        CapPayeeInfoQueryCondition payeeInfoQueryCondition = new CapPayeeInfoQueryCondition();
        payeeInfoQueryCondition.setPayId(Long.valueOf(id));
        payeeInfoQueryCondition.setSortOrder(" PURP_CD ");
        List<CapPayeeInfoVO> payeeVOList = capPayeeInfoService.searchListForSpecialCar(payeeInfoQueryCondition);
        Map<String, CapPayeeInfoVO> payeeMap = null;
        if (CollectionUtils.isNotEmpty(payeeVOList)) {
            payeeMap = new HashMap<>(payeeVOList.size());
            for (CapPayeeInfoVO payeeInfoVO : payeeVOList) {
                payeeMap.put(payeeInfoVO.getPurpCd(), payeeInfoVO);
            }
        }
        //其他收费项
        List<PrjPrdPaySchDDTO> paySchDList = this.capPayeeInfoService.searchPrjRebateForSpecialCar(vo.getPaySchId());
        Map<String, Long> rebateMap = null;
        if (CollectionUtils.isNotEmpty(paySchDList)) {
            rebateMap = new HashMap<>(paySchDList.size());
            for (PrjPrdPaySchDDTO paySchDDTO : paySchDList) {
                if (paySchDDTO.getFeeAmt() > 0) {
                    if (CapitalConstant.CODE_FEE_TYP_CD_08.equals(paySchDDTO.getFeeTypCd())) {
                        //融资额返利
                        rebateMap.put(CapitalConstant.CODE_ZC_BK_PURP_CD_2, paySchDDTO.getFeeAmt().longValue());
                    } else if (CapitalConstant.CODE_FEE_TYP_CD_30.equals(paySchDDTO.getFeeTypCd())) {
                        //购置税
                        rebateMap.put(CapitalConstant.CODE_ZC_BK_PURP_CD_5, paySchDDTO.getFeeAmt().longValue());
                    } else if (CapitalConstant.CODE_FEE_TYP_CD_32.equals(paySchDDTO.getFeeTypCd())) {
                        //保险总额
                        //rebateMap.put(CapitalConstant.CODE_ZC_BK_PURP_CD_4, paySchDDTO.getFeeAmt().longValue());
                    } else if (CapitalConstant.CODE_FEE_TYP_CD_24.equals(paySchDDTO.getFeeTypCd())) {
                        //上牌抵押
                        rebateMap.put(CapitalConstant.CODE_ZC_BK_PURP_CD_8, paySchDDTO.getFeeAmt().longValue());
                    }
                }
            }
        }
        //查询事业部对应的收款账号有几个用途
        List<KeyValueVO> kvList = new ArrayList<KeyValueVO>();
        kvList = this.capPayeeInfoService.getPayeeByOrgCd(vo.getBuOrgCd());
        List<CapPayeeInfoVO> payeeList = new ArrayList<>(kvList.size());
        if (CollectionUtils.isNotEmpty(kvList)) {
            List<String> purpList = new ArrayList<>(kvList.size());
            CapPayeeInfoVO payee = null;
            Long feeAmt = null;
            for (KeyValueVO kv : kvList) {
                if (CapitalConstant.CODE_ZC_BK_PURP_CD_1.equals(kv.getKey())) {//收款账号
                    if (CollectionUtils.isMapNotEmpty(payeeMap) && payeeMap.containsKey(kv.getKey())) {
                        payee = payeeMap.get(kv.getKey());
                        if (StringUtils.isEmpty(payee.getPayAmt())) {
                            payee.setPayAmt(vo.getPayAmt());
                        }
                        if (StringUtils.isBlank(payee.getPayWayCd())) {
                            payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                        }
                        if (null != payee.getActPayTm()) {
                            payee.setActPayTms(DateUtils.formatDateToString(payee.getActPayTm(), DateUtils.YYYY_MM_DD));
                        }
                        if (StringUtils.isNotEmpty(payee.getActPayAmt())) {
                            payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getActPayAmt())));
                        }
                        payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(vo.getPayAmt())));
                        payee.setRealPayAmt(vo.getPayAmt());
                    } else {
                        payee = new CapPayeeInfoVO(kv.getKey(), kv.getValue());
                        payee.setPayAmt(vo.getPayAmt());
                        payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                        payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(vo.getPayAmt())));
                        payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                        payee.setRealPayAmt(vo.getPayAmt());
                    }
                    payeeList.add(payee);
                    purpList.add(payee.getPurpCd());
                } else {
                    //返利账户等信息（如果支付表没有返利，不添加返利账户信息）
                    if (CollectionUtils.isMapNotEmpty(rebateMap) && rebateMap.containsKey(kv.getKey())) {
                        feeAmt = rebateMap.get(kv.getKey());
                        if (CollectionUtils.isMapNotEmpty(payeeMap) && payeeMap.containsKey(kv.getKey())) {
                            if (CapitalConstant.CODE_ZC_BK_PURP_CD_2.equalsIgnoreCase(kv.getKey())) { //供应商返利
                                payee = payeeMap.get(kv.getKey());
                            } else if (CapitalConstant.CODE_ZC_BK_PURP_CD_4.equalsIgnoreCase(kv.getKey())) { //保险
                                payee = payeeMap.get(kv.getKey());
                                payee.setPurpCdNm(kv.getValue());
                            } else if (CapitalConstant.CODE_ZC_BK_PURP_CD_5.equalsIgnoreCase(kv.getKey())) { //购置税
                                payee = payeeMap.get(kv.getKey());
                                payee.setPurpCdNm(kv.getValue());
                            } else if (CapitalConstant.CODE_ZC_BK_PURP_CD_8.equalsIgnoreCase(kv.getKey())) { //购置税
                                payee = payeeMap.get(kv.getKey());
                                payee.setPurpCdNm(kv.getValue());
                            }
                            //供应商返利应付金额有可能会修改
                            if (StringUtils.isEmpty(payee.getPayAmt())) {
                                payee.setPayAmt(feeAmt);
                                payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                            } else {
                                payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getPayAmt())));
                            }
                            /**
                             * 增加保单判断
                             */
                            if ("1".equals(isModifyAmt) && CapitalConstant.CODE_ZC_BK_PURP_CD_4.equalsIgnoreCase(kv.getKey())) {
                                InsPlcBscInfoQueryCondition qc = new InsPlcBscInfoQueryCondition();
                                qc.setPaySchId(vo.getPaySchId());
                                qc.setPaySchNo(vo.getPaySchNo());
                                qc.setIsDel(0);
                                GetInsPlcBscInfoListRequest getListRequest = new GetInsPlcBscInfoListRequest(qc);
                                getListRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
                                getListRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
                                BaseLogUtils.info(logger, "searchList", "贷前--获取保单数据，request:" + JSONObject.toJSONString(getListRequest), CurrentThreadContext.getCurrentUserName());
                                ResponseData<List<InsPlcBscInfoDTO>> infoResponse = insPlcBscInfoService.searchList(getListRequest);
                                BaseLogUtils.info(logger, "searchList", "贷前--获取保单数据,response:" + JSONObject.toJSONString(infoResponse), CurrentThreadContext.getCurrentUserName());
                                if (null != infoResponse && ResponseData.SUCCESS_CODE.equals(infoResponse.getCode()) && CollectionUtils.isNotEmpty(infoResponse.getData())){
                                    List<InsPlcBscInfoDTO> insPlcList = infoResponse.getData();
                                    if (CollectionUtils.isNotEmpty(insPlcList)) {
                                        Long realPayTotal = 0l;
                                        for (InsPlcBscInfoDTO insPlcBscInfoVO : insPlcList) {
                                            realPayTotal += insPlcBscInfoVO.getInsTtlFee();
                                        }
                                        payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(realPayTotal)));
                                    } else {
                                        if (StringUtils.isEmpty(payee.getRealPayAmt())) {
                                            payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                                        } else {
                                            payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getRealPayAmt())));
                                        }
                                    }
                                }

                            } else {
                                if (StringUtils.isEmpty(payee.getRealPayAmt())) {
                                    payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                                } else {
                                    payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getRealPayAmt())));
                                }
                            }
                            if (StringUtils.isBlank(payee.getPayWayCd())) {
                                payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                            }
                            if (null != payee.getActPayTm()) {
                                payee.setActPayTms(DateUtils.formatDateToString(payee.getActPayTm(), DateUtils.YYYY_MM_DD));
                            }
                            if (StringUtils.isNotEmpty(payee.getActPayAmt())) {
                                payee.setActPayAmts(df.format(DecimalUtils.convertFenToYuan(payee.getActPayAmt())));
                            }
                        } else {
                            SysOrgBankAccQC sysOrgBankAccQC = new SysOrgBankAccQC();
                            SysOrgDTO sysOrgDTO = sysOrgApiService.selectById(CurrentThreadContext.getCurrentOrgId());
                            sysOrgBankAccQC.setOrgCd(sysOrgDTO.getOrgCd());
                            List<SysOrgBankAccDTO> sysOrgBankAccDTOs = orgBankAccApiService.searchList(sysOrgBankAccQC); // 省公司账号集合
                            SysOrgBankAccDTO sysOrgBankAccDTO = null;
                            if (sysOrgBankAccDTOs != null && sysOrgBankAccDTOs.size() > 0) {
                                sysOrgBankAccDTO = sysOrgBankAccDTOs.get(0);
                            }
                            SysEmpBankAccQueryCondition bankAccQueryCondition = new SysEmpBankAccQueryCondition();
                            bankAccQueryCondition.setIsDel(0);
                            bankAccQueryCondition.setUsrId(vo.getCstMgrId());
                            List<SysEmpBankAccDTO> sysEmpBankAccDTOs = sysEmpBankAccApiService.searchList(bankAccQueryCondition);
                            SysEmpBankAccDTO sysEmpBankAccDTO = null;
                            if (sysEmpBankAccDTOs != null && sysEmpBankAccDTOs.size() > 0) {
                                sysEmpBankAccDTO = sysEmpBankAccDTOs.get(0);
                            }
                            payee = new CapPayeeInfoVO(kv.getKey(), kv.getValue());
                            if ("2".equalsIgnoreCase(kv.getKey())) {
                                payee.setBkId(null);
                                payee.setRcptUnt(null);
                                payee.setAccNo(null);
                                payee.setPayeeBkNm(null);
                                payee.setPayeeBkNo(null);
                                payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                            }
                            if (null != sysOrgBankAccDTO && ("4".equalsIgnoreCase(kv.getKey()) || "2".equalsIgnoreCase(kv.getKey()))) {
                                if ("2".equalsIgnoreCase(kv.getKey())) {
                                    payee.setBkId(null);
                                    payee.setRcptUnt(null);
                                    payee.setAccNo(null);
                                    payee.setPayeeBkNm(null);
                                    payee.setPayeeBkNo(null);
                                    payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                                } else {
                                    payee.setBkId(sysOrgBankAccDTO.getId());
                                    payee.setRcptUnt(sysOrgBankAccDTO.getRcptUnt());
                                    payee.setAccNo(sysOrgBankAccDTO.getAccNo());
                                    payee.setPayeeBkNm(sysOrgBankAccDTO.getBkNm());
                                    payee.setPayeeBkNo(sysOrgBankAccDTO.getBkNo());
                                    payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_4);
                                    payee.setBkAccTypCd("0");
                                }
                            } else if (null != sysEmpBankAccDTO && "5".equalsIgnoreCase(kv.getKey())) {
                                payee.setBkId(sysEmpBankAccDTO.getId());
                                payee.setRcptUnt(sysEmpBankAccDTO.getRcptUnt());
                                payee.setAccNo(sysEmpBankAccDTO.getAccNo());
                                payee.setPayeeBkNm(sysEmpBankAccDTO.getBkNm());
                                payee.setPayeeBkNo(sysEmpBankAccDTO.getBkNo());
                                payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_5);
                                payee.setBkAccTypCd("1");
                            } else if (null != sysEmpBankAccDTO && "8".equalsIgnoreCase(kv.getKey())) {
                                if (vo.getCstMgrOrgCd().indexOf(PrjBscInfoConstant.CODE_ORG_CD_YZDG) >= 0) {
                                    payee.setBkId(sysEmpBankAccDTO.getId());
                                    payee.setRcptUnt(sysEmpBankAccDTO.getRcptUnt());
                                    payee.setAccNo(sysEmpBankAccDTO.getAccNo());
                                    payee.setPayeeBkNm(sysEmpBankAccDTO.getBkNm());
                                    payee.setPayeeBkNo(sysEmpBankAccDTO.getBkNo());
                                    payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_5);
                                    payee.setBkAccTypCd("1");
                                }
                            } else {
                                payee.setBkId(null);
                                payee.setRcptUnt(null);
                                payee.setAccNo(null);
                                payee.setPayeeBkNm(null);
                                payee.setPayeeBkNo(null);
                                payee.setPayeeTypCd(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                            }
                            payee.setRealPayAmt(feeAmt);
                            payee.setRealPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                            payee.setPayAmt(feeAmt);
                            payee.setPayAmts(df.format(DecimalUtils.convertFenToYuan(feeAmt)));
                            payee.setPayWayCd(CapitalConstant.CODE_PAYEE_PAY_WAY_CD_3);//默认网银
                        }
                        payee.setRebateAmt(feeAmt);//返利金额
                        payeeList.add(payee);
                        purpList.add(payee.getPurpCd());
                    }
                }
            }
            mav.addObject("accSize", purpList);
        }

        String proIntId = request.getParameter("processInstanceId");//流程实例ID
        String procNm = request.getParameter("procNm");//流程定义名称
        String taskId = request.getParameter("taskId");//任务ID
        mav.addObject("proIntId", proIntId);
        mav.addObject("procNm", procNm);
        mav.addObject("taskId", taskId);
        mav.addObject("taskDefKey", taskDefKey);
        mav.addObject("taskNm", taskNm);

        //是否显示合同通过意见
        String showHtOpn = request.getParameter("showHtOpn");
        if (StringUtils.isEmpty(showHtOpn)) showHtOpn = "0";
        //是否显示抵押通过意见
        String showDyOpn = request.getParameter("showDyOpn");
        if (StringUtils.isEmpty(showDyOpn)) showDyOpn = "0";
        //是否显示驳回意见
        String showRejOpn = request.getParameter("showRejOpn");
        if (StringUtils.isEmpty(showRejOpn)) showRejOpn = "0";

        mav.addObject("showHtOpn", showHtOpn);
        mav.addObject("showDyOpn", showDyOpn);
        mav.addObject("showRejOpn", showRejOpn);

        /** --------------------- by YAOXIURONG --------------------- */

        //专车放款发送网银标识	1:全部发送	2.发送保险,购置税		3.发送车款,经销商返利		4.发送车款	5.发送经销商返利
        String busPayFlag = request.getParameter("busPayFlag");
        String isAllowSendPay = "0";//是否显示发送网银按钮
        if ("1".equals(busPayFlag)) {
            if (CollectionUtils.isNotEmpty(payeeList)) {
                for (CapPayeeInfoVO capPayeeInfoVO : payeeList) {
                    //先查询
                    InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
                    //不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
                    if (null == bfsPayDTO
                            || InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
                            || InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())) {
                        isAllowSendPay = "1";
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
                    } else {
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
                    }
                }
            }
        } else if ("2".equals(busPayFlag)) {
            for (CapPayeeInfoVO capPayeeInfoVO : payeeList) {
                String purpCd = capPayeeInfoVO.getPurpCd();
                if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_3.equals(purpCd)
                        || CapPayeeInfoConstant.CODE_PURP_CD_00000008_4.equals(purpCd)) {
                    //先查询
                    InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
                    //不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
                    if (null == bfsPayDTO
                            || InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
                            || InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())) {
                        isAllowSendPay = "1";
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
                    } else {
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
                    }

                }
            }
        } else if ("3".equals(busPayFlag)) {
            for (CapPayeeInfoVO capPayeeInfoVO : payeeList) {
                String purpCd = capPayeeInfoVO.getPurpCd();
                if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_1.equals(purpCd)
                        || CapPayeeInfoConstant.CODE_PURP_CD_00000008_2.equals(purpCd)) {
                    //先查询
                    InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
                    //不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
                    if (null == bfsPayDTO
                            || InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
                            || InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())) {
                        isAllowSendPay = "1";
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
                    } else {
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
                    }
                }
            }
        } else if ("4".equals(busPayFlag)) {
            for (CapPayeeInfoVO capPayeeInfoVO : payeeList) {
                String purpCd = capPayeeInfoVO.getPurpCd();
                if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_1.equals(purpCd)) {
                    //先查询
                    InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
                    //不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
                    if (null == bfsPayDTO
                            || InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
                            || InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())) {
                        isAllowSendPay = "1";
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
                    } else {
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
                    }
                }
            }
        } else if ("5".equals(busPayFlag)) {
            for (CapPayeeInfoVO capPayeeInfoVO : payeeList) {
                String purpCd = capPayeeInfoVO.getPurpCd();
                if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_2.equals(purpCd)) {
                    //先查询
                    InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
                    //不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
                    if (null == bfsPayDTO
                            || InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
                            || InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())) {
                        isAllowSendPay = "1";
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
                    } else {
                        capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
                    }
                }
            }
        }
        mav.addObject("isAllowSendPay", isAllowSendPay);
        mav.addObject("busPayFlag", busPayFlag);

        mav.addObject("payeeList", payeeList);

        //by YAOXIURONG 17-9-1
        String QZTX = request.getParameter("QZTX");//起租提醒节点标识
        mav.addObject("QZTX", QZTX);
        /** --------------------- by YAOXIURONG --------------------- */

        String saveOrgBizOpnCd = request.getParameter("saveOrgBizOpnCd");//是否可以编辑三方业务处理意见 1:可以编辑
        mav.addObject("saveOrgBizOpnCd", saveOrgBizOpnCd);
        //三方业务处理意见
        List<KeyValueVO> orgBizOpnCdList = this.capPayInfoService.searchOrgBizOpnCdList();
        mav.addObject("orgBizOpnCdList", orgBizOpnCdList);
        PrjBscExtDTO prjBscExtDTO = this.prjBscExtApiService.searchById(vo.getPrjId());
        if(null==prjBscExtDTO) prjBscExtDTO = new PrjBscExtDTO();
        mav.addObject("prjBscExtDTO", prjBscExtDTO);
        mav.addObject("insCode", prjBscInfoVO.getInsCode());

        String splRiskWarnCd = null;//供应商高风险预警标识
        String lnkRiskWarnCd = null;//挂靠公司高风险预警标识
        if (StringUtils.isNotEmpty(vo.getPrjPrdId()) || StringUtils.isNotEmpty(vo.getPrjPrdDtlId())){
            PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(vo.getPrjPrdId());
            PrjPrdDtlVO PrdDtlVO = this.prjPrdDtlService.selectById(vo.getPrjPrdDtlId());
            if (prjPrdBscInfoVO != null || PrdDtlVO != null){
                if (prjPrdBscInfoVO.getSplId() != null || prjPrdDtlVO.getLnkCompId() != null){
                    //供应商高风险预警
                    SplHRiskWarnRecQC splHRiskWarnRecQC = new SplHRiskWarnRecQC();
                    if (prjPrdBscInfoVO.getSplId() != null){
                        splHRiskWarnRecQC.setDataId(prjPrdBscInfoVO.getSplId());
                        splHRiskWarnRecQC.setDataTyp("SPL"); //SPL:供应商  LNK:挂靠公司
                        splHRiskWarnRecQC.setIsWarn(1);
                        splHRiskWarnRecQC.setIsDel(0);
                        splHRiskWarnRecQC.setIsValid(1);
                        splHRiskWarnRecQC.setIsNew(1);
                    }
                    List<SplHRiskWarnRecDTO> splHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(splHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
                    BaseLogUtils.info(logger, "initList", "查询供应商高风险预警接口返回：" + JSONObject.toJSONString(splHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
                    //挂靠公司高风险预警
                    SplHRiskWarnRecQC lnkHRiskWarnRecQC = new SplHRiskWarnRecQC();
                    if (prjPrdDtlVO.getLnkCompId() != null){
                        lnkHRiskWarnRecQC.setDataId(prjPrdDtlVO.getLnkCompId());
                        lnkHRiskWarnRecQC.setDataTyp("LNK"); //SPL:供应商  LNK:挂靠公司
                        lnkHRiskWarnRecQC.setIsWarn(1);
                        lnkHRiskWarnRecQC.setIsDel(0);
                        lnkHRiskWarnRecQC.setIsValid(1);
                        lnkHRiskWarnRecQC.setIsNew(1);
                    }
                    List<SplHRiskWarnRecDTO> lnkHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(lnkHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
                    BaseLogUtils.info(logger, "initList", "查询挂靠公司高风险预警接口返回：" + JSONObject.toJSONString(lnkHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
                    //查询供应商、挂靠公司高风险预警标识结果
                    if (CollectionUtils.isNotEmpty(splHRiskWarnRecDTOList) || CollectionUtils.isNotEmpty(lnkHRiskWarnRecDTOList)){
                        splRiskWarnCd = "1";
                        lnkRiskWarnCd = "1";
                    }
                }
            }
        }
        if (StringUtils.isNotBlank(isAllowPay) && "0".equals(isAllowPay)){
            mav.addObject("entrance",0);
            mav.addObject("accCtrl",1);
            mav.addObject("ctrlKey",3);
            mav.addObject("isAddBank",0);
            mav.addObject("isOrDefaultTime",0);
            mav.addObject("isModifyAmt",0);
            mav.addObject("isNeedAddTime",0);
            mav.addObject("operateInsPlc",0);
            mav.addObject("isAllowPay",0);
            mav.addObject("rcptUntIsMdf",0);
            mav.addObject("isAuditNode",0);
            mav.addObject("feeAmtAndDtIsMdf",0);
        }
        mav.addObject("splRiskWarnCd", splRiskWarnCd);
        mav.addObject("lnkRiskWarnCd", lnkRiskWarnCd);
        BaseLogUtils.newLogger("跳转付款申请单页面End,view:{}", JSON.toJSON(mav)).info();
        return mav;
    }

    /**
     * 专车修改操作 jiangzg 2017-8-23 17:33:04
     */
    @RequestMapping(value = "/modifyBySpecialCar.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modifyBySpecialCar(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        CapPayInfoVO entity = null;
        try {
            entity = this.getRequestParamForCapPayInfo(request);
            if (entity == null || entity.getId() == null) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayInfo信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
                return result;
            }
            String dueDt = request.getParameter("dueDt");
            String isNeedAddTime = request.getParameter("isNeedAddTime");
            String isModifyAmt = request.getParameter("isModifyAmt");
           /* -------------------tiansainan-----------------------------------------*/
            String TD = request.getParameter("TD");//团单（tsn）
            String id = request.getParameter("id");//id（tsn）
            String updInsLoan = request.getParameter("updInsLoan");
            if (StringUtils.isNotEmpty(updInsLoan) && updInsLoan.equals("1")){
                if (entity.getIsOutInsLoan() == 1 && entity.getInsLoanTm() == null ) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("机构放款时间不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 1 && StringUtils.isEmpty(entity.getInsLoanSum())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("机构放款金额不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 0 && StringUtils.isEmpty(entity.getPayerAccNo())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("付款账户为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 0 && StringUtils.isEmpty(entity.getPayerBkNm())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("开户行名称不能为空！");
                    return result;
                }
            } else if (StringUtils.isNotEmpty(updInsLoan) && updInsLoan.equals("2")){
                if (StringUtils.isEmpty(entity.getIsOutInsLoan())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("是否外部机构放款不能为空！");
                    return result;
                }
                if (entity.getIsOutInsLoan() == 1 && StringUtils.isEmpty(entity.getLoanInsCode())) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("放款机构名称不能为空！");
                    return result;
                }
            }

             if(StringUtils.isBlank(id)){
            	 result.setSuccess(BaseConstant.IS_YESNO_NO);
                 result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                 BaseLogUtils.info(logger, "modifyPrjBscInfo", "数据主键不能为空" , CurrentThreadContext.getCurrentUserName());
                 return result;
             }else{
            	 CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(id));
     			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(capPayInfoVO.getPrjId());//查出项目基础信息
     			if (StringUtils.isNotBlank(TD)) {
     				prjBscInfoVO.setIsGrpBiz(Integer.valueOf(TD));
     			}
     			boolean modify = this.prjBscInfoService.modify(prjBscInfoVO);
     			if(modify){
     				 BaseLogUtils.info(logger, "modifyPrjBscInfo", "修改成功" , CurrentThreadContext.getCurrentUserName());
     			}else{
     				BaseLogUtils.info(logger, "modifyPrjBscInfo", "修改失败" , CurrentThreadContext.getCurrentUserName());
     			}
             }
			
	
			  /* -------------------tiansainan-----------------------------------------*/
            if (null != entity.getPayeeList() && StringUtils.isNotBlank(isModifyAmt) && "1".equalsIgnoreCase(isModifyAmt)) {
                for (CapPayeeInfoVO vo : entity.getPayeeList()) {
                    //应付金额
                    if (CapitalConstant.CODE_SPL_BK_PURP_CD_1.equals(vo.getPurpCd())) {
                        if (StringUtils.isNotEmpty(entity.getPayerAccNo())){
                            vo.setPayerAccNo(entity.getPayerAccNo());
                        }
                        if (StringUtils.isNotEmpty(entity.getPayerBkNm())){
                            vo.setPayerBkNm(entity.getPayerBkNm());
                        }
                    }
                    vo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    vo.setMdfTm(new Date());
                }
                boolean flag = this.capPayeeInfoService.batchModify(entity.getPayeeList());
                if (!flag) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                    BaseLogUtils.info(logger, "modifyCapPayInfo", "修改CapPayeeInfo数据失败.DATA:" + JSONObject.toJSONString(entity.getPayeeList()), CurrentThreadContext.getCurrentUserName());
                    return result;
                } else {
                    return result;
                }
            }
            if (StringUtils.isNotBlank(isNeedAddTime) && "1".equalsIgnoreCase(isNeedAddTime)) {
                if (StringUtils.isNotBlank(dueDt)) {
                    PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectById(entity.getPrjPrdDtlId());
                    if (prjPrdDtlVO != null) {
                        prjPrdDtlVO.setDueDt(DateUtils.formatStringToDate(dueDt, "yyyy-MM-dd"));
                        boolean flag = this.prjPrdDtlService.modify(prjPrdDtlVO);
                        if (flag) {
                            return result;
                        } else {
                            result.setSuccess(BaseConstant.IS_YESNO_NO);
                            result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                            BaseLogUtils.info(logger, "modifyBySpecialCar", "修改PrjPrdDtlVO数据失败.DATA:" + JSONObject.toJSONString(prjPrdDtlVO), CurrentThreadContext.getCurrentUserName());
                            return result;
                        }
                    }
                }
            }
            boolean success = this.capPayInfoService.modify(entity);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                BaseLogUtils.info(logger, "modifyBySpecialCar", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                return result;
            }

            //查询收款方信息
            CapPayeeInfoQueryCondition payeeInfoQueryCondition = new CapPayeeInfoQueryCondition();
            payeeInfoQueryCondition.setPayId(entity.getId());
            List<CapPayeeInfoVO> payeeVOList = capPayeeInfoService.searchList(payeeInfoQueryCondition);
            if (CollectionUtils.isNotEmpty(payeeVOList)) {
                List<KeyValueVO> kvList = new ArrayList<>(payeeVOList.size());
                KeyValueVO kv = null;
                for (CapPayeeInfoVO vo : payeeVOList) {
                    kv = new KeyValueVO();
                    if (StringUtils.isNotBlank(vo.getPurpCd())) {
                        kv.setKey(vo.getPurpCd());
                        kv.setValue(vo.getId() + "");
                    } else {
                        kv.setKey(CapitalConstant.CODE_SPL_BK_PURP_CD_1);
                        kv.setValue(vo.getId() + "");
                    }
                    kvList.add(kv);
                }
                result.setData(kvList);
            }
            BaseLogUtils.info(logger, "modifyBySpecialCar", "修改CapPayInfo数据成功.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            BaseLogUtils.error(logger, "-", "异常", ex);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "modifyBySpecialCar", "修改CapPayInfo数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            BaseLogUtils.error(logger, "-", "异常", ex);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "modifyBySpecialCar", "修改CapPayInfo数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }


    /**
     * 工行代扣卡页面
     */
    @RequestMapping(value = "/toAddCorpBankInfo.do", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public ModelAndView toAddCorpBankAccInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        ModelAndView view = new ModelAndView("capital/capPayInfo/addCapPayInfoBankAcc");
        String paySchId = request.getParameter("paySchId");
        PrjPrdPaySchMVO vo = null;
        if (StringUtils.isNotBlank(paySchId)) {
            vo = this.prjPrdPaySchMService.selectById(Long.valueOf(paySchId));
        }
        if (null != vo) {
            view.addObject("crCardNo", vo.getCrCardNo());
        } else {
            view.addObject("crCardNo", "");
        }
        view.addObject("prjPrdPaySchMVO", vo);
        BaseLogUtils.info(logger, "toAddCorpBankInfo", "跳转到银行账户列表页面.paySchId:" + paySchId, CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 工行代扣卡页面
     */
    @RequestMapping(value = "/toCorpBankInfoDetail.do", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public ModelAndView toCorpBankInfoDetail(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        ModelAndView view = new ModelAndView("capital/capPayInfo/capPayInfoCorpBankDetail");
        String paySchId = request.getParameter("paySchId");
        PrjPrdPaySchMVO vo = null;
        if (StringUtils.isNotBlank(paySchId)) {
            vo = this.prjPrdPaySchMService.selectById(Long.valueOf(paySchId));
        }
        if (null != vo) {
            view.addObject("crCardNo", vo.getCrCardNo());
        } else {
            view.addObject("crCardNo", "");
        }
        view.addObject("prjPrdPaySchMVO", vo);
        BaseLogUtils.info(logger, "toListPage", "跳转到银行卡账户页面!", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 工行代扣卡页面
     */
    @RequestMapping(value = "/toSaveCorpBankAcc.do", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Object saveCorpBankAccInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO vo = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        String paySchId = request.getParameter("paySchId");
        String crCardNo = request.getParameter("crCardNo");
        if (StringUtils.isNotBlank(paySchId) && StringUtils.isNotBlank(crCardNo)) {
            PrjPrdPaySchMVO prjPrdPaySchMVO = null;
            if (StringUtils.isNotBlank(paySchId)) {
                prjPrdPaySchMVO = this.prjPrdPaySchMService.selectById(Long.valueOf(paySchId));
            }
            if (null != prjPrdPaySchMVO) {
                prjPrdPaySchMVO.setCrCardNo(crCardNo);
                boolean flag = this.prjPrdPaySchMService.modifyCrCardNo(prjPrdPaySchMVO);
                if (!flag) {
                    vo.setSuccess(BaseConstant.IS_YESNO_NO);
                    vo.setInfo("修改银行账户失败！");
                }
            }
        } else {
            vo.setSuccess(BaseConstant.IS_YESNO_NO);
            vo.setInfo("参数不完整！");
        }
        BaseLogUtils.info(logger, "saveCorpBankAccInfo", "修改银行账户信息!", CurrentThreadContext.getCurrentUserName());
        return vo;
    }

    /**
     * 到逾期明细页面
     */
    @RequestMapping(value = "/toRepaymentDtl.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toOverdueDtl(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toModifyPage", "加载到逾期明细页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capRepaymentDtl");

        String paySchId = request.getParameter("paySchId");
        String payPd = request.getParameter("payPd");
        String payDetailId = request.getParameter("payDetailId");
        String feeTypCd = request.getParameter("feeTypCd");
        CapFundVfDtlQueryCondition queryCondition = new CapFundVfDtlQueryCondition();
        if (StringUtils.isNotBlank(paySchId)) {
            queryCondition.setPaySchId(Long.valueOf(paySchId));
        }
        if (StringUtils.isNotBlank(payPd)) {
            queryCondition.setPayPd(Long.valueOf(payPd));
        }
        if (StringUtils.isNotBlank(feeTypCd)) {
            if ("S01".equalsIgnoreCase(feeTypCd)) {
                List<String> feeTypCdList = new ArrayList<>(2);
                feeTypCdList.add("S02");
                feeTypCdList.add("S03");
                queryCondition.setIncludeFeeTypCdList(feeTypCdList);
            } else {
                if (StringUtils.isNotBlank(payDetailId)) {
                    queryCondition.setPayDetailId(Long.valueOf(payDetailId));
                }
            }
        }
        queryCondition.setIsDel(0);
        queryCondition.setVfStsCd("2");
        queryCondition.setVfTypCd("1");
            queryCondition.setSortName(" T.FEE_TYP_CD DESC , T.VF_DT");
        queryCondition.setSortOrder("DESC");
        if(StringUtils.isBlank(paySchId) && StringUtils.isBlank(payPd)){
            BaseLogUtils.info(logger, "toRepaymentDtl", "获取还款情况详细，参数不全!", "{paySchId:" + paySchId + "payPd:" + payPd + "}\t 操作人：" + CurrentThreadContext.getCurrentUserName());
            return null;
        }
        List<CapFundVfDtlVO>  capFundVfDtlVOs = this.capFundVfDtlService.searchList(queryCondition);
        ListPageVO<CapFundVfDtlVO> listPage = null;
        if(CollectionUtils.isNotEmpty(capFundVfDtlVOs)){
            listPage = new ListPageVO<CapFundVfDtlVO>(capFundVfDtlVOs,capFundVfDtlVOs.size());
            mav.addObject("capFundVfDtlVOs",JSON.toJSONString(listPage));
        }else{
            mav.addObject("capFundVfDtlVOs", JSON.toJSONString(new ListPageVO<CapFundVfDtlVO>(new ArrayList<CapFundVfDtlVO>(),0)));
        }
        return mav;
    }

    /**
     * 发送征信查询请求
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/sendCredit.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object sendCredit(HttpServletRequest request, HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");//付款ID
		String prjId = request.getParameter("prjId");//项目ID
		if(StringUtils.isEmpty(capPayId) && StringUtils.isEmpty(prjId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "sendCredit", SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY, CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			if(StringUtils.isNotEmpty(capPayId)){
				CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(capPayId));
				
				BaseLogUtils.info(logger, "sendCredit", "===提交征信Start===prjId:"+capPayInfoVO.getPrjId()+",prjPrdPaySchId:"+capPayInfoVO.getPaySchId());
				/*MessageDTO<String> messageDTO = this.icbcApi.submitCredit(171225242000321L, "icbc", capPayInfoVO.getPrjId(),capPayInfoVO.getPaySchId());
				BaseLogUtils.info(logger, "sendCredit", "===提交征信End===prjId:"+capPayInfoVO.getPrjId()+",messageDTO:"+JSON.toJSONString(messageDTO));
				if(null!=messageDTO && messageDTO.isSuccess()){
					result.setSuccess(BaseConstant.IS_YESNO_YES);
					result.setInfo("提交征信成功,请等待处理结果.");
				}else if(null!=messageDTO && !messageDTO.isSuccess()){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("提交征信失败,请联系管理员."+messageDTO.getMessage());
				}else{
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("提交征信失败,请联系管理员.");
				}*/
			}else if(StringUtils.isNotEmpty(prjId)){
				PrjPrdPaySchMQueryCondition paySchQC = new PrjPrdPaySchMQueryCondition();
				paySchQC.setPrjId(Long.valueOf(prjId));
                paySchQC.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
				List<PrjPrdPaySchMVO> prjPrdPaySchMDTOList = this.prjPrdPaySchMService.searchList(paySchQC);
				for (PrjPrdPaySchMVO prjPrdPaySchMVO : prjPrdPaySchMDTOList) {
					BaseLogUtils.info(logger, "sendCredit", "===提交征信Start===prjId:"+prjId+",prjPrdPaySchId:"+prjPrdPaySchMVO.getId());
					//MessageDTO<String> messageDTO = this.icbcApi.submitCredit(171225242000321L, "icbc", Long.valueOf(prjId), prjPrdPaySchMVO.getId());
					//BaseLogUtils.info(logger, "sendCredit", "===提交征信End===prjId:"+prjId+",messageDTO:"+JSON.toJSONString(messageDTO));
					/*if(null!=messageDTO && messageDTO.isSuccess()){
						result.setSuccess(BaseConstant.IS_YESNO_YES);
						result.setInfo("提交征信成功,请等待处理结果.");
					}else if(null!=messageDTO && !messageDTO.isSuccess()){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("提交征信失败,请联系管理员."+messageDTO.getMessage());
						break;
					}else{
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("提交征信失败,请联系管理员.");
						break;
					}*/
				}
			}
//			result.setSuccess(BaseConstant.IS_YESNO_YES);
//			result.setInfo("请求发送成功,请等待处理结果.");
			BaseLogUtils.info(logger, "sendCredit", "发送征信查询请求成功.", CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "sendCredit", "发送征信查询请求失败.DATA:"+capPayId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "sendCredit", "发送征信查询请求请求失败,系统错误.DATA:"+capPayId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}


    //更新实际交车时间
    @RequestMapping(value = "/modifyDueDt.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO modifyDueDt(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        String dueDt = request.getParameter("dueDt");
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        String id = request.getParameter("id");
        BaseLogUtils.info(logger, "modifyDueDt", "修改实际交车时间.ID=" + id + ",prjPrdDtlId=" + prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
        String paySchIds = request.getParameter("paySchIds");//主键
        String lsDt = request.getParameter("lsDt");
        if(StringUtils.isNotBlank(lsDt)){
    	   Long ids = Long.valueOf(paySchIds);
           Date lsDts = DateUtils.formatStringToDate(lsDt, "yyyy-MM-dd");
           this.prjPrdPaySchMService.modifylsDt(ids,lsDts);
           BaseLogUtils.info(logger, "modifyDueDt", "修改起租日成功.paySchIds=" + ids , CurrentThreadContext.getCurrentUserName());

        }
        PrjPrdDtlVO prjPrdDtlVO = null;
        try {
            if(StringUtils.isBlank(dueDt)&&StringUtils.isEmpty(prjPrdDtlId)){
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("请选择实际交车时间");
                return result;
            }

            prjPrdDtlVO = this.prjPrdDtlService.selectById(Long.valueOf(prjPrdDtlId));
            if (prjPrdDtlVO != null) {
                prjPrdDtlVO.setDueDt(DateUtils.formatStringToDate(dueDt, "yyyy-MM-dd"));
                boolean flag = this.prjPrdDtlService.modify(prjPrdDtlVO);
                if (flag) {
                    BaseLogUtils.info(logger, "modifyDueDt", "修改实际交车时间成功.ID="+id+",prjPrdDtlId="+prjPrdDtlId,CurrentThreadContext.getCurrentUserName());
                    return result;
                }
            }
        } catch (BaseException e) {
            BaseLogUtils.info(logger, "modifyDueDt", "修改实际交车时间异常.ID="+id+",prjPrdDtlId="+prjPrdDtlId,CurrentThreadContext.getCurrentUserName(),e);
        } catch (NumberFormatException e) {
            BaseLogUtils.info(logger, "modifyDueDt", "修改实际交车时间数值转换异常.ID="+id+",prjPrdDtlId="+prjPrdDtlId,CurrentThreadContext.getCurrentUserName(),e);
        }
        result.setSuccess(BaseConstant.IS_YESNO_NO);
        result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
        BaseLogUtils.info(logger, "modifyDueDt", "修改实际交车时间失败.DATA:" + JSONObject.toJSONString(prjPrdDtlVO), CurrentThreadContext.getCurrentUserName());
        return result;
    }

    /**
     * 校验《所有权转让协议首页》是否上传，若未上传不可发起放款流程
     *
     * @param request
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/validateFileUpload.do")
    @ResponseBody
    public Object validateFileUpload(HttpServletRequest request) throws BaseException {

        String prjId = request.getParameter("prjId");// 项目ID
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");// 项目产品明细ID

        return this.capPayInfoService.checkTransfeOfTitle(Long.valueOf(prjId), Long.valueOf(prjPrdDtlId));
    }

    /**
     * 根据产品明细id查询是否上传合格证
     * @param request
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/selectVehInfoByPrjPrdDtlId.do")
    @ResponseBody
    public Object selectVehInfoByPrjPrdDtlId(HttpServletRequest request) throws BaseException {
        String prjPrdDtlId = request.getParameter("prjPrdDtlId");
        String prjId = request.getParameter("prjId");
        String paySchNo = request.getParameter("paySchNo");
        List<SysUlFilesRecVO> vehInfoFileList;
        String fileId = null;
        StringBuilder infoBuilder = new StringBuilder();

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if (StringUtils.isEmpty(prjPrdDtlId)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("产品明细id不能为空");
            return result;
        }

        JSONObject jsonObject = new JSONObject();
        SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
        fileQc.setCfgCd(PrjPrdBscInfoConstant.PRJ_PRD_FILE_CFG_CODE);
        fileQc.setSysCd(CurrentThreadContext.getFlServiceSysCd());
        fileQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
        fileQc.setIsDel(0);
        fileQc.setCfgDtlCd(PrjPrdBscInfoConstant.PRJ_PRD_FILE_VEH_PHOTO_CODE);
        fileQc.setPkId(prjPrdDtlId);
        fileQc.setTabNm(PrjPrdBscInfoConstant.PRJ_PRD_FILE_VEH_PHOTO_TABLE_NM);
        BaseLogUtils.info(logger, "selectVehInfoByPrjPrdDtlId", "查询合格证文件资料入参" + JSONObject.toJSONString(fileQc));
        vehInfoFileList = this.sysUlFilesRecService.searchList(fileQc);
        BaseLogUtils.info(logger, "selectVehInfoByPrjPrdDtlId", "查询合格证文件资料结果" + JSONObject.toJSONString(vehInfoFileList));
        if (CollectionUtils.isEmpty(vehInfoFileList)) {
            infoBuilder.append("合格证未上传! ");
        }
        jsonObject.put("vehInfoFileList",vehInfoFileList);

        PrjPrdInvoiceQueryCondition qc = new PrjPrdInvoiceQueryCondition();
        qc.setFlag(PrjPrdBscInfoConstant.PRJ_PRD_FILE_INVOICE_CODE_10);
        if(StringUtils.isBlank(paySchNo) && StringUtils.isBlank(prjId)){
            PrjPrdDtlVO prjPrdDtlVO = prjPrdDtlService.selectById(Long.valueOf(prjPrdDtlId));
            paySchNo = prjPrdDtlVO.getPaySchNo();
            prjId = String.valueOf(prjPrdDtlVO.getPrjId());
        }
        qc.setPaySchNo(paySchNo);
        qc.setPrjId(prjId);
        List<PrjPrdInvoiceVO> prjPrdInvoiceList =this.prjPrdInvoiceService.searchPrjPrdInvoiceList(qc);
        if (CollectionUtils.isNotEmpty(prjPrdInvoiceList)) {
            fileId = prjPrdInvoiceList.get(0).getFileId();
            if (StringUtils.isEmpty(fileId)) {
                infoBuilder.append("设备发票原件未上传! ");
            }
        }
        jsonObject.put("invoiceFileId",fileId);
        result.setInfo(infoBuilder.toString());
        result.setData(jsonObject);
        return result;
    }

    /**
     * 到车抵贷（YQ）手动扣款列表页面
     */
    @RequestMapping(value = "/toCddYqCutPayListPage.do", method = {RequestMethod.GET})
    public ModelAndView toCddYqCutPayListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mav = new ModelAndView("capital/capPayInfo/cddYqCutPayList");
        BaseLogUtils.newWebLogger("跳转到车抵贷（YQ）手动扣款列表页面").setLogOperType(LogOperEnum.OTHER_REQ).setSysCd(CurrentThreadContext.getCurrentSysCd()).setBussinessId(BusinessIdConstant.LOG_CAPITAL_MANAGER_CD).setWarning(false).info();
        return mav;
    }

    /**
     * 初始化车抵贷（YQ）手动扣款列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initCddYqCutPayList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initCddYqCutPayList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }
        String cstNm = request.getParameter("cstNm");//客户名称
        String contNo = request.getParameter("contNo");//合同号
        String cutPaySchNo = request.getParameter("cutPaySchNo");//扣款支付表号
        String isAllAuth = request.getParameter("isAllAuth");//是否全权限数据
        String actPayTmBg = request.getParameter("actPayTmBg");//实际放款时间开始
        String actPayTmEd = request.getParameter("actPayTmEd");//实际放款时间结束

        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(contNo)) {
            qc.setContNo(contNo);
        }
        if (StringUtils.isNotEmpty(cutPaySchNo)) {
            qc.setCutPaySchNo(cutPaySchNo);
        }
        if (StringUtils.isNotEmpty(isAllAuth)) {
            qc.setIsAllAuth(isAllAuth);
        }
        if (StringUtils.isNotEmpty(actPayTmBg)) {
            qc.setActPayTmBg(actPayTmBg);
        }
        if (StringUtils.isNotEmpty(actPayTmEd)) {
            qc.setActPayTmEd(actPayTmEd);
        }
        page.setCondition(qc);
        BaseLogUtils.newWebLogger("===查询车抵贷（YQ）手动扣款列表参数===page:" + JSON.toJSONString(page)).info();
        Pager pager = this.capPayInfoService.searchCddYqCutPayListPage(page);
        List<CapPayInfoVO> list = (List<CapPayInfoVO>) pager.getResultList();
        ListPageVO<CapPayInfoVO> listPage = new ListPageVO<CapPayInfoVO>(list, pager.getTotalCount());
        BaseLogUtils.newWebLogger("===查询车抵贷（YQ）手动扣款列表数据===listPage:" + JSON.toJSONString(listPage)).info();
        return listPage;
    }

    /**
     * 抵贷（YQ）确认扣款
     */
    @RequestMapping(value = "/confirmCutPay.do", method = {RequestMethod.POST })
    @ResponseBody
    public DataResultVO confirmCutPay(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");//付款id
        String cstId = request.getParameter("cstId");//客户id
        String cutPaySchNo = request.getParameter("cutPaySchNo");//扣款支付表号
        String paySchId = request.getParameter("paySchId");//疫情贷项目支付表id
        String paySchNo = request.getParameter("paySchNo");//疫情贷项目支付表号
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if(StringUtils.isEmpty(id)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("付款id不能为空");
            return result;
        }
        if(StringUtils.isEmpty(cstId)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("客户id不能为空");
            return result;
        }
        if(StringUtils.isEmpty(cutPaySchNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("扣款支付表号不能为空");
            return result;
        }
        if(StringUtils.isEmpty(paySchId)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("疫情贷项目支付表id不能为空");
            return result;
        }
        if(StringUtils.isEmpty(paySchNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("疫情贷项目支付表号不能为空");
            return result;
        }
        try {
            DataResultDTO resultDTO = this.capPayInfoService.confirmCutPay(id, cstId, cutPaySchNo, paySchId, paySchNo);
            if (null == resultDTO || BaseConstant.IS_YESNO_NO == resultDTO.getSuccess()) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(resultDTO.getInfo());
            } else {
                RepaymentResultDTO repaymentResultDTO = (RepaymentResultDTO)resultDTO.getData();
                if (null == repaymentResultDTO) {
                    throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "车抵贷（疫情）扣款处理失败.");
                } else {
                    if (!BaseConstant.IS_YESNO_YES_STR.equals(repaymentResultDTO.getPayStsCd())) {
                        result.setSuccess(BaseConstant.IS_YESNO_YES);
                        result.setInfo(repaymentResultDTO.getResultesc());
                    }
                }
            }
        }catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("操作失败,ex:" + JSON.toJSONString(ex.getMessage())).info();
        }catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
            BaseLogUtils.newWebLogger("操作失败,ex:" + JSON.toJSONString(ex)).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
        }
        return result;
    }

    /**
     * 到系统运维车抵贷（YQ）手动扣款列表页面
     */
    @RequestMapping(value = "/toCddYqCutPaySystemListPage.do", method = {RequestMethod.GET})
    public ModelAndView toCddYqCutPaySystemListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mav = new ModelAndView("capital/capPayInfo/cddYqCutPaySystemList");
        BaseLogUtils.newWebLogger("跳转到系统运维车抵贷（YQ）手动扣款列表页面").setLogOperType(LogOperEnum.OTHER_REQ).setSysCd(CurrentThreadContext.getCurrentSysCd()).setBussinessId(BusinessIdConstant.LOG_CAPITAL_MANAGER_CD).setWarning(false).info();
        return mav;
    }

    /**
     * 到车抵贷（YQ）手动扣款（全部数据）列表页面
     */
    @RequestMapping(value = "/toCddYqCutPaySuccessListPage.do", method = {RequestMethod.GET})
    public ModelAndView toCddYqCutPaySuccessListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mav = new ModelAndView("capital/capPayInfo/cddYqCutPayAllList");
        BaseLogUtils.newWebLogger("跳转到车抵贷（YQ）手动扣款（全部数据）列表页面").setLogOperType(LogOperEnum.OTHER_REQ).setSysCd(CurrentThreadContext.getCurrentSysCd()).setBussinessId(BusinessIdConstant.LOG_CAPITAL_MANAGER_CD).setWarning(false).info();
        return mav;
    }

    /**
     * 初始化车抵贷（YQ）手动扣款（扣款失败）列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initCddYqCutPayFailList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initCddYqCutPayFailList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }
        String cstNm = request.getParameter("cstNm");//客户名称
        String contNo = request.getParameter("contNo");//合同号
        String cutPaySchNo = request.getParameter("cutPaySchNo");//扣款支付表号
        String actPayTmBg = request.getParameter("actPayTmBg");//实际放款时间开始
        String actPayTmEd = request.getParameter("actPayTmEd");//实际放款时间结束

        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(contNo)) {
            qc.setContNo(contNo);
        }
        if (StringUtils.isNotEmpty(cutPaySchNo)) {
            qc.setCutPaySchNo(cutPaySchNo);
        }
        if (StringUtils.isNotEmpty(actPayTmBg)) {
            qc.setActPayTmBg(actPayTmBg);
        }
        if (StringUtils.isNotEmpty(actPayTmEd)) {
            qc.setActPayTmEd(actPayTmEd);
        }
        page.setCondition(qc);
        BaseLogUtils.newWebLogger("===查询车抵贷（YQ）手动扣款（扣款失败）列表参数===page:" + JSON.toJSONString(page)).info();
        Pager pager = this.capPayInfoService.searchCddYqCutPayFailListPage(page);
        List<CapPayInfoVO> list = (List<CapPayInfoVO>) pager.getResultList();
        ListPageVO<CapPayInfoVO> listPage = new ListPageVO<CapPayInfoVO>(list, pager.getTotalCount());
        BaseLogUtils.newWebLogger("===查询车抵贷（YQ）手动扣款（扣款失败）列表数据===listPage:" + JSON.toJSONString(listPage)).info();
        return listPage;
    }

    /**
     * 车抵贷（YQ）刷新扣款状态
     */
    @RequestMapping(value = "/refreshCutPayStsCd.do", method = {RequestMethod.POST })
    @ResponseBody
    public DataResultVO refreshCutPayStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String cutPaySchNo = request.getParameter("cutPaySchNo");//扣款支付表号
        String paySchNo = request.getParameter("paySchNo");//疫情贷项目支付表号
        String cstId = request.getParameter("cstId");//客户id
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if(StringUtils.isEmpty(cutPaySchNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("扣款支付表号不能为空");
            return result;
        }
        if(StringUtils.isEmpty(paySchNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("疫情贷项目支付表号不能为空");
            return result;
        }
        if(StringUtils.isEmpty(cstId)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("客户id不能为空");
            return result;
        }
        try {
            DataResultDTO resultDTO = this.capPayInfoService.refreshCutPayStsCd(cutPaySchNo, paySchNo, cstId);
            if (null == resultDTO || BaseConstant.IS_YESNO_NO == resultDTO.getSuccess()) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(resultDTO.getInfo());
            } else {
                RepaymentResultDTO repaymentResultDTO = (RepaymentResultDTO)resultDTO.getData();
                if (null == repaymentResultDTO) {
                    throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "车抵贷（疫情）实时查询刷新扣款状态失败.");
                } else {
                    result.setSuccess(BaseConstant.IS_YESNO_YES);
                    result.setInfo(repaymentResultDTO.getResultesc());
                    result.setData(repaymentResultDTO);
                }
            }
        }catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("操作失败,ex:" + JSON.toJSONString(ex.getMessage())).info();
        }catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
            BaseLogUtils.newWebLogger("操作失败,ex:" + JSON.toJSONString(ex)).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
        }
        return result;
    }

    /**
     * 到放款录单管理列表页面
     */
    @RequestMapping(value = "/toPayRecListPage.do", method = {RequestMethod.GET})
    public ModelAndView toPayRecListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.newServiceLogger("加载PayRecListPage列表页面.操作人:" + CurrentThreadContext.getCurrentUserName()).info();
        ModelAndView mav = new ModelAndView("capital/capPayInfo/capPayRecList");
        //项目类型
        List<KeyValueVO> projectTypeList = this.prjBscInfoService.getPrjTypCdALLKV();
        if(CollectionUtils.isNotEmpty(projectTypeList)) {
            for (KeyValueVO keyValueVO : projectTypeList) {
                keyValueVO.setIsHide(false);
            }
        }
        // 事业部
        List<KeyValueVO> orgList = this.cstBscInfoService.searchBusinessOrgList();
        //付款状态
        List<KeyValueVO> payStsCdList = this.capPayInfoService.getPayStsCdList();
        //申请来源
        List<KeyValueVO> applyResCdList = this.capPayInfoService.getApplyResCdList();
        //首期款代收
        List<KeyValueVO> fstColCdList = this.capPayInfoService.getFstColCdList();
        //领取状态
        List<KeyValueVO> receiveStsCdList = this.sysDictionaryApiService.getKvList(AudStandingBookConstant.RECEIVE_STATE, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());

        mav.addObject("receiveStsCdList", JSON.toJSONString(receiveStsCdList));
        mav.addObject("prjTypCdList", JSON.toJSONString(projectTypeList));
        mav.addObject("buOrgCdList", JSON.toJSONString(orgList));
        mav.addObject("payStsCdList", JSON.toJSONString(payStsCdList));
        mav.addObject("applyResCdList", JSON.toJSONString(applyResCdList));
        mav.addObject("fstColCdList", JSON.toJSONString(fstColCdList));
        mav.addObject("currentOrgCd",CurrentThreadContext.getCurrentOrgCd());
        mav.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
        //第三方机构
        FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
        qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
        qc.setInsUseCd("2");
        qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
        qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
        List<FriBaseInfoVO> friBaseInfoVOS = this.friBaseInfoService.searchList(qc);
        mav.addObject("friBaseList", friBaseInfoVOS);
        return mav;
    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initPayRecList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initPayRecList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        //设置查询条件
        String contNo = request.getParameter("contNo");//合同号
        String paySchNo = request.getParameter("paySchNo");//支付表号
        String buOrgCd = request.getParameter("buOrgCd");//事业部
        String prjTypCds = request.getParameter("prjTypCd");//项目类型
        String cstNm = request.getParameter("cstNm");//客户名称
        String actPayTmBg = request.getParameter("actPayTmBg");//实际付款时间开始
        String actPayTmEd = request.getParameter("actPayTmEd");//实际付款时间结束
        String payAmtMin = request.getParameter("payAmtMin");//付款金额 小
        String payAmtMax = request.getParameter("payAmtMax");//付款金额 大
        String payStsCd = request.getParameter("payStsCd");//付款状态
        String applyResCd = request.getParameter("applyResCd");//申请来源
        String cstMgrNm = request.getParameter("cstMgrNm");//客户经理
        String isFstCol = request.getParameter("isFstCol");//首期款代收
        String installmentCd = request.getParameter("installmentCd");//保险分期
        String insCode = request.getParameter("insCode");//第三方机构编号
        String isSplMfr = request.getParameter("isSplMfr");// 是否厂商业务
        String isInsBiz = request.getParameter("isInsBiz");//是否资管业务
        String rgnProvCd = request.getParameter("rgnProvCd");//业务归属 省
        String rgnCityCd = request.getParameter("rgnCityCd");//业务归属 城市
        String isAllAuth = request.getParameter("isAllAuth");// 是否全权限数据
        //领取状态
        String receiveState = request.getParameter("receiveState");
        //发送开始时间
        String sendTmBg = request.getParameter("sendTmBg");
        //发送结束时间
        String sendTmEd = request.getParameter("sendTmEd");
        //领取开始时间
        String receiveTmBg = request.getParameter("receiveTmBg");
        //领取结束时间
        String receiveTmEd = request.getParameter("receiveTmEd");
        //领取人
        String receiveUsrNm = request.getParameter("receiveUsrNm");

        CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
        //放款录单台账
        qc.setBookTypeCd(AuditConstans.AudTypeCdEnum.AUD_TYP_CD_FL.key());

        if (StringUtils.isNotEmpty(isSplMfr)) {
            qc.setIsSplMfr(Long.valueOf(isSplMfr));
        }
        //第三方机构编号
        if (StringUtils.isNotEmpty(insCode)) {
            qc.setInsCode(insCode);
        }
        if (StringUtils.isNotEmpty(payStsCd)) {
            qc.setPayStsCd(payStsCd);
        }
        if(StringUtils.isNotEmpty(applyResCd)){
            qc.setApplyResCd(applyResCd);
        }
        if (StringUtils.isNotEmpty(cstMgrNm)) {
            qc.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotEmpty(isFstCol)) {
            qc.setIsFstCol(Integer.valueOf(isFstCol));
        }
        if (StringUtils.isNotEmpty(contNo)) {
            qc.setContNo(contNo);
        }
        if (StringUtils.isNotEmpty(paySchNo)) {
            qc.setPaySchNo(paySchNo);
        }
        if (StringUtils.isNotEmpty(buOrgCd)) {
            qc.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotEmpty(prjTypCds)) {
            List<String> prjTypCdList = Arrays.asList(prjTypCds.split(";"));
            qc.setPrjTypCdList(prjTypCdList);
        }
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(actPayTmBg)) {
            qc.setActPayTmBg(actPayTmBg);
        }
        if (StringUtils.isNotEmpty(actPayTmEd)) {
            qc.setActPayTmEd(actPayTmEd);
        }
        if (StringUtils.isNotEmpty(payAmtMin)) {
            qc.setActPayAmtMin(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMin)));
        }
        if (StringUtils.isNotEmpty(payAmtMax)) {
            qc.setActPayAmtMax(DecimalUtils.convertYuanToFen(Double.valueOf(payAmtMax)));
        }
        if (StringUtils.isNotEmpty(installmentCd)) {
            qc.setInstallmentCd(installmentCd);
        }
        if (StringUtils.isNotEmpty(isInsBiz)) {
            qc.setIsInsBiz(Integer.valueOf(isInsBiz));
        }
        // 业务归属城市  rgnProvCd 省 rgnCityCd 市
        if (StringUtils.isNotEmpty(rgnProvCd)) {
            qc.setRgnProvCd(rgnProvCd);
        }
        if (StringUtils.isNotEmpty(rgnCityCd)) {
            qc.setRgnCityCd(rgnCityCd);
        }
        if (StringUtils.isNotEmpty(isAllAuth)) {
            qc.setIsAllAuth(isAllAuth);
        }
        if (StringUtils.isNotEmpty(receiveState)) {
            qc.setReceiveState(receiveState);
        }
        if (StringUtils.isNotEmpty(sendTmBg)) {
            qc.setSendTmBg(DateUtils.formatStringToDate(sendTmBg, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(sendTmEd)) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(DateUtils.formatStringToDate(sendTmEd, DateUtils.YYYY_MM_DD));
            cal.add(Calendar.DATE, 1);
            qc.setSendTmEd(DateUtils.formatDate(cal.getTime(), DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(receiveTmBg)) {
            qc.setReceiveTmBg(DateUtils.formatStringToDate(receiveTmBg, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(receiveTmEd)) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(DateUtils.formatStringToDate(receiveTmEd, DateUtils.YYYY_MM_DD));
            cal.add(Calendar.DATE, 1);
            qc.setReceiveTmEd(DateUtils.formatDate(cal.getTime(), DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(receiveUsrNm)) {
            qc.setReceiveUsrNm(receiveUsrNm);
        }
        if (StringUtils.isEmpty(sendTmBg)){
            Calendar instance = Calendar.getInstance();
            instance.setTime(new Date());
            instance.add(Calendar.YEAR, -1);
            qc.setSendTmBg(DateUtils.formatDate(instance.getTime(), DateUtils.YYYY_MM_DD));
        }
        page.setCondition(qc);
        Pager pager = this.capPayInfoService.searchPayRecListPage(page);
        BaseLogUtils.newServiceLogger("init PayRecList END DATA:" + JSON.toJSONString(page) + "操作人:" + CurrentThreadContext.getCurrentUserName()).info();
        List<CapPayInfoVO> list = (List<CapPayInfoVO>) pager.getResultList();
        ListPageVO<CapPayInfoVO> listPage = new ListPageVO<>(list, pager.getTotalCount());
        return listPage;
    }
}

